From ce8c60ddeb3c1beaacbe0356e9bbf7f66db4702e Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Sat, 22 Jul 2023 07:43:06 +0400 Subject: [PATCH 01/48] =?UTF-8?q?=D0=97=D0=B0=D0=BC=D0=B5=D0=BD=D0=B0=20?= =?UTF-8?q?=D0=B1=D0=B8=D0=B1=D0=BB=D0=B8=D0=BE=D1=82=D0=B5=D0=BA=D0=B8=20?= =?UTF-8?q?=D0=BD=D0=B0=20=D1=81=D0=B0=D0=B9=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Я пришёл к выводу, что веб-сервер будет намного точнее и быстрее, чем библиотека tinyld. Поэтому я решил создать сервер для определения языка. Он работает достаточно быстро и очень точно. --- dist/vot-cloudflare-min.user.js | 4 +- dist/vot-cloudflare.user.js | 90 +++++++++++++++++---------------- dist/vot-min.user.js | 4 +- dist/vot.user.js | 90 +++++++++++++++++---------------- src/config/constants.js | 2 +- src/index.js | 41 ++++++--------- src/indexedDB.js | 20 +++++--- src/utils/getYTVideoData.js | 32 +++++++----- src/utils/utils.js | 6 ++- 9 files changed, 151 insertions(+), 138 deletions(-) diff --git a/dist/vot-cloudflare-min.user.js b/dist/vot-cloudflare-min.user.js index 57f8809a..2ee115a9 100644 --- a/dist/vot-cloudflare-min.user.js +++ b/dist/vot-cloudflare-min.user.js @@ -13,7 +13,7 @@ // @description:it Una piccola estensione che aggiunge la traduzione vocale del video dal browser Yandex ad altri browser // @description:ru Небольшое расширение, которое добавляет закадровый перевод видео из Яндекс Браузера в другие браузеры // @description:zh 一个小扩展,它增加了视频从Yandex浏览器到其他浏览器的画外音翻译 -// @version 1.3.3 +// @version 1.3.4-testing // @author sodapng, mynovelhost, Toil, SashaXser // @supportURL https://github.com/ilyhalight/voice-over-translation/issues // @match *://*.youtube.com/* @@ -84,4 +84,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,n,t)=>{t.d(n,{Z:()=>s});var o=t("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=t.n(o),i=t("./node_modules/css-loader/dist/runtime/api.js"),r=t.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var n=[];return n.toString=function(){return this.map((function(n){var t="",o=void 0!==n[5];return n[4]&&(t+="@supports (".concat(n[4],") {")),n[2]&&(t+="@media ".concat(n[2]," {")),o&&(t+="@layer".concat(n[5].length>0?" ".concat(n[5]):""," {")),t+=e(n),o&&(t+="}"),n[2]&&(t+="}"),n[4]&&(t+="}"),t})).join("")},n.i=function(e,t,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),t&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=t):u[2]=t),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),n.push(u))}},n}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var n=[];function t(e){for(var t=-1,o=0;o{var n={};e.exports=function(e,t){var o=function(e){if(void 0===n[e]){var t=document.querySelector(e);if(window.HTMLIFrameElement&&t instanceof window.HTMLIFrameElement)try{t=t.contentDocument.head}catch(e){t=null}n[e]=t}return n[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(t)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var n=document.createElement("style");return e.setAttributes(n,e.attributes),e.insert(n,e.options),n}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,n,t)=>{e.exports=function(e){var n=t.nc;n&&e.setAttribute("nonce",n)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var n=e.insertStyleElement(e);return{update:function(t){!function(e,n,t){var o="";t.supports&&(o+="@supports (".concat(t.supports,") {")),t.media&&(o+="@media ".concat(t.media," {"));var a=void 0!==t.layer;a&&(o+="@layer".concat(t.layer.length>0?" ".concat(t.layer):""," {")),o+=t.css,a&&(o+="}"),t.media&&(o+="}"),t.supports&&(o+="}");var i=t.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),n.styleTagTransform(o,e,n.options)}(n,e,t)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(n)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,n){if(n.styleSheet)n.styleSheet.cssText=e;else{for(;n.firstChild;)n.removeChild(n.firstChild);n.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,n,t)=>{t.d(n,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,n,t)=>{t.d(n,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,n,t)=>{t.d(n,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,n,t)=>{function o(e){const n=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?n:n.toUpperCase()}t.r(n),t.d(n,{default:()=>l});var a=t("./src/yandexRequests.js"),i=t("./src/config/config-cloudflare.js"),r=t("./src/config/config.js"),s=t("./src/utils/debug.js");const l=async function(e,n,t,l,d){let u,c;const m=o(!0),g=a.G.encodeRequest(e,m,n,t,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),n=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),t=await window.crypto.subtle.sign("HMAC",n,g),a=Array.from(new Uint8Array(t),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...g)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,n,t)=>{t.d(n,{Z:()=>o}),t("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,n,t)=>{t.d(n,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,n,t,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:n,firstRequest:!0,unknown1:t,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},n={};function t(o){var a=n[o];if(void 0!==a)return a.exports;var i=n[o]={id:o,exports:{}};return e[o](i,i.exports,t),i.exports}t.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return t.d(n,{a:n}),n},t.d=(e,n)=>{for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},t.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.nc=void 0,(()=>{var e=t("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),n=t.n(e),o=t("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=t.n(o),i=t("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=t.n(i),s=t("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=t.n(s),d=t("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=t.n(d),c=t("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),m=t.n(c),g=t("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),p={};p.styleTagTransform=m(),p.setAttributes=l(),p.insert=r().bind(null,"head"),p.domAPI=a(),p.insertStyleElement=u(),n()(g.Z,p),g.Z&&g.Z.locals&&g.Z.locals;var h=/[,.。,、#%&/\\+*¡!¿?[\]!?;:…„“«»”"“_–—~]/gi,A=/[0-9]/g,I=/[\uFF10-\uFF19]/g,b=/\s\s+/g,f=/’/gi,B=/[\u0300-\u036f]/g;function D(e){return e.normalize("NFD").replace(B,"")}var F={light:{TRAINING_UNIQUE_GRAMS:[1,2,3,4],TOP_LANGUAGE_UNIQUE_GRAMS:60,TOP_LANGUAGE_STATS_GRAMS:50},normal:{TRAINING_UNIQUE_GRAMS:[1,2,3,4,5],TOP_LANGUAGE_UNIQUE_GRAMS:100,TOP_LANGUAGE_STATS_GRAMS:180},heavy:{TRAINING_UNIQUE_GRAMS:[1,2,3,4,5],TOP_LANGUAGE_UNIQUE_GRAMS:320,TOP_LANGUAGE_STATS_GRAMS:1024}},v="light",y=F[v].TRAINING_UNIQUE_GRAMS,L=(F[v].TOP_LANGUAGE_UNIQUE_GRAMS,F[v].TOP_LANGUAGE_STATS_GRAMS,1e4);function M(e){return Math.round(e*L)/L}var T=e=>{let n={only:[],verbose:!1};return e?Object.assign(n,e):n},C={afr:{code:"af",region:"africa",name:"Afrikaans",skipLight:!0},amh:{code:"am",region:"africa",name:"Amharic",skipLight:!0,coefProb:0},ber:{code:"ber",region:"africa",name:"Berber",skipLight:!0,coefProb:.25},run:{code:"rn",region:"africa",name:"Kirundi",skipLight:!0},jpn:{code:"ja",region:"asia-east",name:"Japanese",alias:["jp"],coefProb:0},cmn:{code:"zh",region:"asia-east",name:"Chinese",alias:["cn"],coefProb:.25},kor:{code:"ko",region:"asia-east",name:"Korean",alias:["kr"],coefProb:0},mya:{code:"my",region:"asia",name:"Burmese",skipLight:!0,coefProb:0},tha:{code:"th",region:"asia",name:"Thai",coefProb:0},vie:{code:"vi",region:"asia",name:"Vietnamese",skipLight:!0,coefProb:0},ind:{code:"id",region:"asia",name:"Indonesian",skipLight:!0},khm:{code:"km",region:"asia",name:"Khmer",skipLight:!0,coefProb:0},tgl:{code:"tl",region:"asia",name:"Tagalog",skipLight:!0},ben:{code:"bn",region:"asia-south",name:"Bengali",coefProb:0},tam:{code:"ta",region:"asia-south",name:"Tamil",skipLight:!0,coefProb:0},hin:{code:"hi",region:"asia-south",name:"Hindi",coefProb:0},urd:{code:"ur",region:"asia-south",name:"Urdu",skipLight:!0,coefProb:0},guj:{code:"gu",region:"asia-south",name:"Gujarati",skipLight:!0,coefProb:0},kan:{code:"kn",region:"asia-south",name:"Kannada",skipLight:!0,coefProb:0},tel:{code:"te",region:"asia-south",name:"Telugu",skipLight:!0,coefProb:0},fra:{code:"fr",region:"europe-west",name:"French"},eng:{code:"en",region:"europe-west",name:"English",alias:["us","gb"]},deu:{code:"de",region:"europe-west",name:"German",coefProb:.5},spa:{code:"es",region:"europe-west",name:"Spanish"},por:{code:"pt",region:"europe-west",name:"Portuguese",alias:["po"]},ita:{code:"it",region:"europe-west",name:"Italian"},nld:{code:"nl",region:"europe-west",name:"Dutch"},gle:{code:"ga",region:"europe-west",name:"Irish",skipLight:!0},lat:{code:"la",region:"europe",name:"Latin",skipLight:!0},ces:{code:"cs",region:"europe",name:"Czech",skipLight:!0},srp:{code:"sr",region:"europe",name:"Serbian",skipLight:!0},ell:{code:"el",region:"europe",name:"Greek",alias:["gr"],coefProb:0},mkd:{code:"mk",region:"europe",name:"Macedonian",skipLight:!0,coefProb:1.5},slk:{code:"sk",region:"europe",name:"Slovak",skipLight:!0},dan:{code:"da",region:"europe-north",name:"Danish",skipLight:!0,coefProb:1.5},swe:{code:"sv",region:"europe-north",name:"Swedish"},fin:{code:"fi",region:"europe-north",name:"Finnish"},nob:{code:"no",region:"europe-north",name:"Norwegian",coefProb:1.5},isl:{code:"is",region:"europe-north",name:"Icelandic",skipLight:!0,coefProb:.5},hun:{code:"hu",region:"europe-east",name:"Hungarian"},ron:{code:"ro",region:"europe-east",name:"Romanian",coefProb:.5},bul:{code:"bg",region:"europe-east",name:"Bulgarian",skipLight:!0},bel:{code:"be",region:"europe-east",name:"Belarusian",skipLight:!0},rus:{code:"ru",region:"europe-east",name:"Russian"},ukr:{code:"uk",region:"europe-east",name:"Ukrainian",skipLight:!0},pol:{code:"pl",region:"europe-east",name:"Polish",coefProb:.5},lit:{code:"lt",region:"europe-east",name:"Lithuanian",skipLight:!0},est:{code:"et",region:"europe-east",name:"Estonian",skipLight:!0},lvs:{code:"lv",region:"europe-east",name:"Latvian",skipLight:!0},hye:{code:"hy",region:"middle-east",name:"Armenian",skipLight:!0,coefProb:0},tur:{code:"tr",region:"middle-east",name:"Turkish"},heb:{code:"he",region:"middle-east",name:"Hebrew",coefProb:0},yid:{code:"yi",region:"middle-east",name:"Yiddish",skipLight:!0,coefProb:.5},ara:{code:"ar",region:"middle-east",name:"Arabic",coefProb:0},pes:{code:"fa",region:"middle-east",name:"Persian",skipLight:!0,coefProb:0},tat:{code:"tt",region:"middle-east",name:"Tatar",skipLight:!0,coefProb:0},kaz:{code:"kk",region:"middle-east",name:"Kazakh",skipLight:!0},mon:{code:"mn",region:"middle-east",name:"Mongolian",skipLight:!0},tuk:{code:"tk",region:"middle-east",name:"Turkmen",skipLight:!0},epo:{code:"eo",region:"other",name:"Esperanto",skipLight:!0,coefProb:.5},vol:{code:"vo",region:"other",name:"Volapuk",skipLight:!0,coefProb:.5},tlh:{code:"tlh",region:"other",name:"Klingon",skipLight:!0,coefProb:.25}},G=new Set(Object.entries(C).filter((e=>!e[1].skipLight)).map((e=>e[0]))),w=[...G.values()],V=(Object.fromEntries(w.map(((e,n)=>[e,n+1]))),Object.fromEntries(w.map(((e,n)=>[n+1,e]))));function k(e){return e in C?C[e].code:e}var H={id:"tinyld-dict",multiples:{" '":"D07M0B"," aa":"B02D34G13"," aan":"DA9"," ac":"72F812907A3YB7VC1GD0GF06JEKM0U"," ace":"A18B0SJEKM0B"," ai":"73F809A08B21C2DG61J7AM0U"," all":"74J83H94XA11C6PD5QF6ZG0UH68I04M0C"," am ":"80U91WJG6"," are":"86UA04B05C0IJ5WL04"," at ":"84LA02D08H93M05"," att":"72K80Q902C1MFKTH04I0FM0D"," av ":"F5YHAJ"," az":"A0CB0BC06IJAJ0LL02M12"," az ":"IS8M0T"," be ":"87GF0AI31"," bir":"80EC11I09J0RMRC"," bli":"80490KD2AF2SH5IL0A"," bu ":"707MD7"," bun":"802903H05I03J4LM8V"," by":"81MF0RH0QL8N"," był":"L86"," c'":"75MC1N"," ce ":"7C9C0EJEM"," che":"74080T907A05B2KCO5D04F05J1JL02"," ci":"71580DA2XB2KC6ID02F04I0LJ5UL5OM0S"," com":"7BX83Z907ACUBKZCASD0UJ45"," con":"7A482ZAITBCQCFLD13J80"," cos":"704808A29B0SCIXJ0N"," cs":"I84"," csa":"IAK"," cu":"70V80LA8EB2DC22D02I07JGCL0AM09"," cu ":"JFJ"," cz":"LBQ"," czy":"L8V"," câ":"B08J84"," că":"JF8"," că ":"JIJ"," d'":"78TB02C0T"," da ":"91KA0LB7UC6LH1OJ0UL07M1L"," das":"9JRA03B1MD02"," dat":"70480A903A04B03C18DK0F0EH0SJ3EL02"," de ":"7SGASGBQWDRVF6KH7JI5FJSGM2H"," deg":"702803C0XD08H7UJ0D"," değ":"M9Z"," di ":"A09CPSH04"," did":"881"," die":"70M80N9LQA16B02C0XD67J05L03"," dig":"704802A0OB0WC05F6Y"," do ":"8BRB9QC02LAM"," don":"73E86X903A0UB05C0SD0DM08"," dov":"C8DJ0C"," du ":"77Q9CNFK1HM3"," dzi":"L83"," dé":"76IA0DB03I0A"," dü":"904I04M86"," e ":"A08BAPC5BI02J6I"," ee":"D9C"," een":"DP5"," egy":"803D03F02G02IQ2"," ei ":"902B02D02GHXH09J61"," ein":"9NHD0O"," el ":"APOI82JBXM08"," ela":"B8PI0Q"," ell":"7BLA8QD03F1QG06H27I2CM0D"," em ":"BB7"," en ":"7D2AM9D9FFH6GBVHJIM2Q"," er ":"9AWD8MF24HSCM02"," era":"A2YB2TC8VD09F09J6I"," es ":"71L9C0AKI"," est":"7KG803AQJBPDC10D02G09I1KJPIM03"," et ":"7ANG2PH8AM0I"," ett":"F7BGDGH32I0TM3Y"," eu ":"716BLEJ43"," ez":"IAFJ03M05"," ez ":"IE3"," fai":"7D780FC0FJ07"," faz":"B7KM1Y"," fö":"FF1I0R"," för":"FI0"," fø":"H23"," ger":"702809933A03B0JC0ND0ZF0DI03J0OM97"," gj":"F1OH3T"," gjø":"H5G"," gy":"F03I4G"," gå":"F4SH2D"," gö":"F41I05MAO"," gör":"F57I0AM8D"," ha ":"A3PCFSF2XH3CI7B"," hab":"70Z80399WA8PB08I05M0K"," hav":"87ZB0XD02F07G05H0EI0GM1C"," he ":"8C6A2JG40"," heb":"903A02B02DH2"," hee":"DD1"," her":"70287O92HA2FB06D1CF08G22H2ZI08L0DM71"," het":"DQKF0PG1IH0DI0I"," hij":"A1HDFL"," his":"70G86WA0QB0OF0DG0AH0MI25L0MM1D"," hj":"F25H1S"," ho ":"C9Y"," hog":"A04D07INN"," hon":"70H808902A0CB0BD25FC8G03I0KL02"," hun":"80J915A03D1DF1XG03HBCI03"," hv":"H8E"," hva":"H6S"," hvo":"H89"," hä":"910F9RGGY"," hän":"90GF1SGOM"," här":"FA7G03"," i'":"844"," ic":"71E8049BTF02L0JM02"," ich":"9NPL0S"," ih":"94PF0JG2SM1R"," ik":"DCMF05G1FHAKI02M29"," ik ":"DSG"," ikk":"G0KHMB"," il ":"7JVCKY"," in ":"8CU9AMCP2DGHF1CJ0A"," io":"B02C89J03"," io ":"CCM"," is ":"8FTDQJF03H05I9O"," iss":"80490AB8F"," ist":"9IXB1WC07F05G1AI0YJ0EL0CMBN"," it ":"881"," iç":"MBC"," içi":"MBB"," j'":"78W"," j'a":"7BH"," ja ":"90QD0EF0CGBYH0II05L1B"," jag":"903D02FSG"," jak":"G0DH06L8G"," je ":"7QE90EDN0L0L"," jeg":"HSGI0KL2P"," jes":"805A03B03F02LN0"," kel":"903D03G1EIBSL02M0I"," kj":"F02H2C"," kn":"849906D07F0OH09"," kno":"86F904D07"," kom":"92YD43F8KG0KH6UI0XL18M10"," kä":"906F2EG65"," ké":"I6F"," kö":"91CF2BG0AI5TM2K"," l'":"7D8C6R"," l'a":"7ACC3S"," le ":"7O2A71CBKF02I2MJ1E"," les":"7HW80990JA13B03C03D0CG02H1QI4GL03"," ll":"A5B"," lo ":"ABKC6EH06"," los":"80S90CADJD09L03"," lä":"90IF5MG3Y"," mai":"77L808903B85C3YG1PI0AJDX"," me ":"77J874ADPB7JC3TD7MG38"," meg":"C14HB1IQXL02"," mi ":"A8LCB4H06I5SJ0NL59M56"," mig":"70680XA02C17F9TI02L02"," mij":"DD6J0BL02"," mit":"70697SA07B02C02F22GC7H1JI5T"," moe":"B04D9J"," mui":"B8ED05G24"," my":"703838F2WG26H19L2C"," má":"A54B0GI66"," már":"IAZ"," må":"F4UH2G"," mé":"71AA0FB0MI4I"," n'":"79SC03"," na ":"903B6QD0VI0NLEF"," nag":"70J902D05F03IA3L0J"," ne ":"7JPC21G1QI6OJ2ZM8Q"," nek":"H06ID2"," nem":"B13C0HD0NISFJ06M02"," nie":"70292PA0HC1HDN2G03LQT"," no ":"826APLB77C0NG0LL06"," noe":"D0AH7AM09"," non":"718806CSG"," nou":"7DUD09G11J2Q"," nu ":"702D2AF2PJS4"," nã":"BLO"," não":"BOG"," nä":"90DF3PG5K"," nå":"F4NH2C"," oc":"70K807A19B0UC10D03F6ZJ1PL12M02"," och":"A0AD08F8NJ10L0D"," of ":"8CFD2K"," og":"C21D06F03H6LL15"," og ":"HEI"," old":"80XI0QMA0"," ole":"GNML02"," oli":"A02C03D07F0AGFEI02L02"," om ":"D7WF8ZH6JJ0Z"," on ":"73X860GSGL58M0P"," onu":"MD6"," op ":"DB4"," opp":"705807C05D04G18H5B"," os ":"702A0OB8L"," ov":"80QA03B0BC06D1EF06G3KH1N"," pe ":"JF5"," pou":"7G1804B1R"," pow":"808L89"," prz":"LGN"," pue":"A97"," på":"FCSH7H"," på ":"FG6HGP"," q":"76F80H903ABABB7C5I"," qu":"7OD80Z905AQPBSGCIB"," qu'":"7A1"," qua":"73L806906B9SCCM"," que":"7O880L903ARRBSGCFQ"," qui":"78480ZA93B1CC3J"," qué":"A7V"," sch":"7028159FXC0ND6WF0BI03J1HL0C"," se ":"76NAEWBA7C3FF17GC2H1YI0XJA1"," she":"888G02"," si ":"74TA4NB0CC8DH1DJ05"," sie":"7069G7A3MC2KG1QH1FI0FL1C"," się":"LJL"," ska":"802F50G03H5AL0D"," sl":"80PC07D12F2VH1NJ0WM04"," sn":"809D0MF24H2AL04"," som":"72583U90AA0UB0WC0FD0OF7CG02HATJ0E"," son":"7B780K91JA4MB0SCFPF0HI02M4O"," su ":"704A8VC1AM0H"," sun":"80FG0UH07JFLM05"," sz":"IHAL53"," sze":"IGNL0N"," sä":"906F3ZG1V"," så":"F59H2X"," så ":"F4OH6M"," sö":"F0UG0LI0HMAA"," söy":"MAI"," să":"JPO"," să ":"JSD"," te ":"74FA7DB2VC1UDF0F0EG25H08I5SJ7ZL0W"," tha":"8LQC02D02"," the":"8SG90DD0L"," thi":"8CJ"," tie":"70J80490IAA4C05D0NG8XI04"," til":"803FB5G13HHKI09"," to ":"8QRH1NLG5"," tod":"81890DA8UB58G3Y"," tou":"7CB80C902D02G03"," tu ":"7CQ903A42B0XC3MJ2BL1V"," tud":"B23IFT"," tul":"704G9PH09I0D"," tä":"904F1BGDN"," um":"80291PBK5C08G02H05J0NL18M1D"," um ":"938BFJ"," uma":"902BBTC07J09L07M0F"," un ":"7GWAHNCGSJF1"," una":"804907AD8CB2I0CJ0T"," une":"7D5804908G0JJ15"," vad":"C3TD1AF6WI0OJ0C"," vag":"704A04B03C02IDR"," van":"704803A0JB03C3IDIJF0TG37H3AIHT"," ve ":"A0GC05M8F"," vi ":"A0KB0MC2HF9WH97"," vil":"715805A02B03C05F8TG0KH9OI28"," voc":"702A03BJYC0CD02J0A"," voi":"74Z806C3SGBNJ58"," vol":"71480490QA1RB1NC5BD2CF04H05IFJJ07M02"," voo":"B05DAT"," vou":"7H6B2Q"," vr":"71ID2BF02J6G"," vä":"F6CG42"," væ":"H2M"," vær":"H6J"," w ":"LD1"," wa":"7028CH97BA02B03D8OF02G02L1XM02"," was":"8D396KD9LL0H"," wat":"818DA4"," we ":"85MD9QL0B"," wh":"88WB02"," wie":"96ZD2NL86"," wir":"9B3"," wit":"86Q906D0GL05"," wo":"85K92WD26L22"," wy":"L8Z"," y ":"72JA8M"," yap":"MFB"," ye":"70F81KA05F02J04M8R"," you":"7028LO"," za":"908A0DB07C02D1VI0EJ07LELM6A"," ze":"91FB03C0AD5QI0AJ0LL2FM0W"," ze ":"DCCL1J"," zij":"DII"," zu":"989A03C06D0PI03L0C"," zu ":"9D5"," à":"73CB0Y"," à ":"7F0B37"," á":"A08B0EI2W"," ä":"90BFCOG13"," är":"904FOEG05"," är ":"FRS"," å":"F1MH6J"," å ":"F02H94"," ç":"70OM8P"," ço":"MAT"," çok":"M9Q"," è":"C5N"," è ":"CIM"," é":"727A21B4XD05H03I9Z"," é ":"BI9"," él":"70NA5YI2E"," él ":"A8XI0R"," és":"A0BB08I5O"," és ":"B0AICW"," ét":"76PI0I"," ê":"70N"," î":"JBJ"," în":"JQR"," în ":"JMV"," înt":"JCC"," ö":"905F1SI2KM50"," ø":"H18"," ü":"917I13M24"," ş":"J0EM61"," şe":"M8W"," şey":"M8F"," ż":"L5R"," że":"L8U"," że ":"LAM"," ș":"J49"," și":"J8Y"," și ":"JBW"," б":"KFE"," бы":"KFG"," был":"KCH"," в":"KQJ"," в ":"KJ7"," все":"K7D"," вы":"KF9"," вы ":"KD5"," д":"KHK"," до":"KCG"," за":"KFA"," зна":"KAI"," к":"KGJ"," ка":"KCG"," как":"KBV"," ко":"KCE"," м":"KM1"," мен":"KAA"," мн":"KCI"," мне":"KDC"," мо":"KET"," мы ":"K9E"," мэр":"K7K"," н":"KS4"," на":"KOV"," на ":"KGM"," не":"KSG"," не ":"KSG"," о":"KLC"," он":"KIF"," он ":"KE5"," она":"K8T"," п":"KR9"," по":"KSD"," пр":"KMB"," при":"KCM"," про":"KEF"," ра":"KCG"," с":"KQB"," ска":"K8F"," т":"KPP"," так":"K94"," те":"KBU"," теб":"KAT"," то":"KPV"," том":"KQN"," ты":"KEE"," ты ":"KIB"," хо":"KBV"," ч":"KEK"," чт":"KKA"," что":"KOQ"," эт":"KL4"," это":"KNI"," я":"KGE"," я ":"KQH"," 他":"2I4"," 他们":"2F5"," 你":"2IJ"," 你可以":"2R5"," 你知道":"2O9"," 她":"29B"," 如果":"2E7"," 如果你":"2SA"," 我":"2SG"," 我不":"2OU"," 我不想":"2O0"," 我不知":"2SD"," 我们":"2QU"," 我們":"2O2"," 我喜欢":"2P1"," 我在":"2CQ"," 我希望":"2PL"," 我想":"2I9"," 我的":"2IV"," 我知道":"2RE"," 我觉得":"2O9"," 汤":"261"," 汤姆":"2SG"," 汤姆不":"2OI"," 湯姆":"2MC"," 这":"26O","' ":"802902C0CD02I02","'a":"753C19L02M1D","'ai":"79OC02","'ai ":"7B4","'d":"80LM1N","'e":"73DC0GM04","'es":"7AHC0R","'est":"7ENC0E","'h":"70JC0H","'i":"71DC0IM08","'l":"80RM0F","'m":"814","'o":"70MC0B","'r":"80S","'s":"83K905D0C","'s ":"875908D0I","'t":"863M06","'t ":"8BS","'u":"70PC0BM3K","'un ":"73HM8K","'v":"80Q","'è":"C0K","'é":"70X","-a":"B02G05I02J4T","-a ":"B05J9K","-c":"70KB02","-l":"707802B0KJ0H","-v":"70TB02G02I02J03","a'":"809D03M16",aa:"90BDDZGD4I03L02M0R","aa ":"GJO",aan:"D5AGGL","aan ":"DE7GMY",aar:"90CB02D9PG0V","aar ":"90KDMG",aat:"904D2KG38L02M1O",abl:"72E81L902A41F02I0DJ08L03M05",aca:"70B803A1RB1LC16J1OL0IM9H",acc:"71R80JA0LC5GD02F06J0V",ach:"72581596DA0KB46C04D28J07L2M",aci:"70P805A5WB1LC1GI02J1JL1VM05","ado ":"AEOBB8C40",adı:"MB0","ag ":"80491FD2LFR8H1OI0JJ04",agy:"IBH",agyo:"ICV",aid:"71B837A02B02D02G0KI09J04",aik:"G8VI03",air:"76K80SA08B0TC02D04G0NI02M0G",ais:"7HE805902A09B8ZG9TJ02","ais ":"7JNA0BBAO",ait:"7DS80KG2QI09M07","ait ":"7JB80HD05G08I0MM06",akk:"D0GG1NH2KI15M2R",alc:"707802A0HB0BC47J0LL06M07",alı:"MAI","amo ":"A0EB0FCDVL0C",ando:"70E804A97BA4C8CD06I07J05",anno:"70680ECA6F07G0I","ant ":"7AE84R90ED1RF10H2MI0GJ1SL03",any:"82UI1SL1PM0N",anı:"MAY",aq:"707A0UB18",aqu:"710A2RB5A",arı:"MFI",ası:"MAT","ato ":"802A1KB1HCLFG04I02L05",att:"72M80S917C7BD09FJ8G4FH2VI22M1S","att ":"90CFLIH40I26","au ":"76S90PB08D04H02J9V",auf:"70894RF02L04","av ":"F52H4LJ0BM04","ave ":"70C88PA0IB0EC0KD02H0D",aw:"80OD02L5H","ay ":"702852A2KC0IM1L",aya:"708803A0YMBU","az ":"A0JB1KIGQJ0AL1YM4J",aze:"802B5MC02D02I02J06L0LM0Q",azi:"704805903B0BC5OD03I0BJ17L0CM0D",aç:"702B1FM2A",añ:"A1M",ać:"L4M","ać ":"L99",ağ:"M4L",ał:"LBO","ał ":"L8S",aş:"J08M62",aș:"J23",aț:"J20","ban ":"702802A19G02IG8M06","bb ":"F0HH07I4H","ben ":"7029AIA0KC04DCFF0CH0IIBNM83",bia:"803A0LB10C4EG02J08L0Y",bili:"70E809A0IB0FC0SI03J0OL0BMA4",bir:"808A0JB04C0OI04J0MMQH","bir ":"A0MB03MP9",bt:"803919A02D0EF04I02","bu ":"704L05MBU",bí:"A0MI0I",bø:"H0K","c'":"715C0F","ca ":"805A5EB6RC5NI05J60L1MM30",cas:"70Q80BA4VB59C30J30L02M0B",cer:"71H80GA51B3SC3VD02F08I05J4AL0CM0H","ch ":"70583I9MMA02B02C04D1CF6PL76","che ":"73K80396OA35B07CQ7D12J0H",chen:"7078059C9A03D0NF09",cho:"72W80V914A4PB3PD0WF06L41",cht:"9EFD4M","cht ":"9LXD9D","ci ":"72SB0HC6GI03J8EL52M15",cie:"71O809A39B10C0UD04F05J0SL8J",ció:"A59I0DL0G",cke:"70280O912F6U",cl:"70G80YA0QB0GC06D02J0M","co ":"702802A56B5FC60D02L4Q","com ":"BARL03",con:"77S81YAENBDQCC5D0DI02J5FL05","con ":"704A9TC8LI05",cont:"74680TA58B79C49D0KJ2N",cor:"72F80FA2GB3XC55D03J1PL05",cos:"703805A2TB1TCEHI02J0Q",cost:"703808A0WB0YCCHJ0N",cq:"C06",cs:"702802I9B",csa:"I4X",ct:"70R81PA16B03D0EJ1DL02",cu:"70V80QA4KB1NC20D06I05J8FL13M1D","cu ":"706JA2L0PM0H",cz:"LFV",czy:"LCZ","czy ":"L92",câ:"B02J2M",cê:"B4R","cê ":"BFB",cí:"A0FB03I03",có:"A0NB03I02L0B",că:"J7G","că ":"JJZ","d'":"720808C08M03",dad:"803A61B6BF0RM0I",dag:"902C09D12F45H2BI0C",dans:"79QD0CF0DH0HJ0AM0D",das:"999A2HB43C02F0AG09I08L08M0S","das ":"9EVA3QB4TD04F07G05","dat ":"703DKNF06G07I27J2V",dde:"806C03D0MF1JH2KI05M0R","dde ":"C02D0KF1LH5OM02","deg ":"H7UI0L","des ":"7BQ807934A3RB1GD04F1SG0MH09I0CJ0D","det ":"91DFOHG0MHPFI1QM02",dett:"704C4GF1KG0OH5QI1HM09",değ:"M8T",deği:"M9M",did:"70384IA18B0YC03I02M04","die ":"70I8079HZA1LC02D5AJ05",dig:"70680290QA0KB0TC05D1JF7PH2UI24","dig ":"90MD3XF7PH66I5A",dl:"80990BF0DH0II03L1L","dn'":"83U","dn't":"86Y",dos:"706A66B79C0EG09I06L0XM09","dos ":"707A8WB8HI04",dov:"C5FJ09",dt:"90AD0RF02H1EI2Z","dt ":"90BD14H1XI11",duğu:"M85",dz:"D02I04LEG",dzi:"LKJ",dzie:"LFS",dä:"902F0XG2I",då:"F0DH07",dé:"71SA0AF04H02I1D",dì:"C06",dí:"A10B02I0F",dó:"A0NB03I0FL07",dø:"H0O",dü:"903I0FM5O",dı:"MBL","dı ":"MBL","e'":"81MM07",ear:"83I902A0IB08C03J1E","eb ":"906A02C02D34J0CL04M02",ece:"70480FA4BB5TC0SD02F02I03J2LL08MCC",eci:"70P80LA3QB5NC1LD04F0HJ2HL2FM0B",eef:"D3M",eeft:"DB7",eel:"80L903D2OF02G13","een ":"83J905A07C03DRHGBPH05",eer:"808909A0OD4BG04H03","eer ":"80A90AA0VD8WH06",eft:"80ID3OF1HH04J04M03","eft ":"80XDCTH07","ego ":"803A17B0PC0BLFR",egy:"802F02H0KIFW","egy ":"ILW","ein ":"70H9HCD13G30H0AI03",eine:"70R9NGD0IG0VH0BI05",eir:"80Y908B69H02I02",eit:"807952A04B3BD0AG40H08I0A","ej ":"F0NI03L9Z","ek ":"80C902D23F0FH02IDUL3HME0",eke:"804902C02D1XF09G1AH09I7BJ03L04M1D","ele ":"91PA0NBDIC0MD1VG0XH1JI2QJCTL1BM0I",elig:"706806907A11B0HC06D09F05H6BI02J0HL08",ella:"809A7WC70D02F0NG7PI02M02",elle:"7J2808929A08C3ND20F25G4WH5GI6VM0L",enc:"74281LA4OB34C02I0QL0FM1W","ene ":"80390OA5AB02C3MD0JG0SHAUI1XJ0FM0O",enge:"70380590OB03D20F0WG03H72I4MM09",erc:"71I807A1AB13C5JI0FJ1KL0GM0L","ere ":"89L92JA1NB0CCF5D1WF02H7FI0XJ54M1L","ero ":"802AB0B3XCA2G0DL07",ery:"831G03L0TM06",esc:"70H80791NA4HB66C27D0JJ6A",está:"AB8BAN",esz:"I7ML7R","ete ":"80491CA0ZB0TC9QD0EF0MH0DI1CJ0ZM0I","ett ":"90LF8EH45IBZ",ette:"76P81D911C2ZD17F0HG4GHANIA4M0H",että:"GDJ","eu ":"72Z902BOVJ6F",eux:"78N","eux ":"7CV",ey:"82CA08G05M8V","ey ":"83UA0DB02C03M4U",ez:"72F90DA1CB19C0ID21I9UJ2LL23M1N","ez ":"782A2EB39I6OJ1QL1YM1Z",ezt:"I4L",eä:"G0N",eç:"702B0PM1Q",eñ:"A0L",eğ:"M6O",eği:"MEV",eğil:"M8S",eș:"J2L",eșt:"J80",fai:"78Y80AC09J04M02",faz:"B6BM1Q",fd:"D0L",fj:"F04H09","for ":"87KB07F02HE2",fs:"702908D07",fy:"F07H08",få:"F12H0R",fè:"702C04",fö:"F6RI0K",för:"FG8M02","för ":"FCB",fø:"H1K",fü:"91XI0E",gee:"D25","ger ":"72Y812921A09B04C0FD26F4HH9KI08J05M02",ggi:"802C4J",ght:"84F","ght ":"702871",gio:"706805902A0CB0FC5ZF02H03J03",gj:"F0MH2YI0R",gje:"H1MI05",gjø:"H2B",gjør:"H5Q",gs:"80I90WD0DF0OH11I0T",gt:"705921D0NF25H0RI18","gt ":"705926D0UF5SH0S",gv:"H08I0K",gy:"804F02G02H0EIMM","gy ":"805IMK",gye:"I6I",gyo:"I62",gå:"F23H1M",gö:"F1GI0CM47",gör:"F3YI05M7E",gü:"902A03I0AM3I",hab:"70Z80294BA5UB07I02M0M",hac:"707903A53F05L02","han ":"81RA13D02FFHG3AHF6","har ":"A0FB1NFG4HIEI05J04M06","hat ":"70L8MX986D05G0FI0VM0E",hav:"84JB1BD02F06G06H07I06M16",have:"87PB0KD05F06H07I03",hd:"802903G1WM02",heb:"903A02D53","heb ":"DB7",hee:"807C0BD3ZG0O",heef:"DAM","her ":"71R89B93HB0XH2NM4Y",here:"87T90CA03B0CC08D03G04","het ":"702DQGF1BG09H2HI3C",hey:"83MM0D",hij:"A0YD4Q","hij ":"DFK","his ":"7038CMJ0QM02",hj:"F0SG09H15",hje:"G08H1Q",hl:"80292QG05L03M0A",hm:"91CG0NL05M04","ho ":"819A3LB96C71G03L04",hog:"A05D02IBW",hogy:"IOC","hon ":"705928F9PG0GI19",hou:"708843B0UD1EG05",hr:"70480N965D0FG02L05M07","hr ":"94G",hre:"80P93ID07G06M04",ht:"8279A9D32G2BM15","ht ":"83W9BLD2K","hun ":"D1DG0MHA3",hv:"G08H5IM0B",hva:"G08H2QM08","hva ":"G06H6R",hve:"G02H1RM0L",hvo:"H3D",hvor:"H89",há:"A02B0MI2Z",hã:"B0F",hä:"910F3NG5S",hän:"90AF1EGHN","hän ":"GKG",häne:"GA2",här:"F7RG02","här ":"F9X",hå:"F0XH0F",hé:"70EA02C0XI0W",hö:"914F1JG03I09",hø:"H0X","i'":"827M0D",iac:"A03C4II02L0B",iam:"702804A08B18C9YG04I0BJ0GL0S",iamo:"A03B02CCY",iał:"L8P","ich ":"70380X9SGA02C04D2AL2Q",icht:"9LFD2V",ici:"72X80GA3MB20C4DD05F08I0CJ9ZL0JM0P","ido ":"A84B4WC0OL02",iedz:"L7I",iene:"90BA7WB02C0WD08G0MH05L0Z","iet ":"702807905DLBF0DG02H0PL03",igh:"70282ZC02D05F0SH11J02",igt:"70490KD07F53","igt ":"70390YD0RF6P",iin:"G9UJ0K","iin ":"GC9","ij ":"D81L0L",ijk:"D3I",ijn:"D87","ijn ":"DN9",ikk:"D07G6PHCOI04M0R",ikke:"D0RG0YHNRI06",inde:"703807933A07B07C03D3JF0CH0CI9EJ0YM5U",inge:"70780892UA06B03C0CD3AF60H86I09J0Q",inh:"903B93G07",inha:"702904B7L","ini ":"70FC20G1IJ0VMCC",inul:"GBJJ0Q",inun:"90GA02B02C02GAYJ0O",inä:"GBK","inä ":"GI2",iq:"70PA04B07","ire ":"7E380MA0CB05CFCD05G0AH0FI2AJ1DM07",isk:"803903D04F3JG2JH1WI0QL0SM09",iss:"74080M91ABAGC1UD0JF1VG6UH0TI1BM16",isso:"70PB99G06","ist ":"80T9K6D26F0FH1BJ0WL0HM06",ith:"70283XB02F02G02L02M03","ito ":"803A2PBA0C68G08","itt ":"90DF4QH6NI5U",ità:"C4G",itä:"907GDT","itä ":"GGE",iy:"MDH",iyo:"MIL",iyor:"MKC","iz ":"702A0OB1VM9Q",ià:"C08",iä:"G14",iç:"B0BM6B",içi:"MAF",için:"MBE",iè:"70N",ié:"70CA0PI16",ië:"D0F",iñ:"A0G",iò:"C0A",ió:"A3DI0KL0H","ió ":"A4EI0A",ión:"A6G","ión ":"A9N",iù:"C0W",ię:"LBV","ię ":"LH5",iğ:"M3S",iği:"M94",ił:"L4K",iş:"J02M3V","j'":"71U","j'a":"774","j'ai":"79W",jag:"FQD","jag ":"FSG",jd:"D14F06I0OL0L",jeg:"HHRI0DL2S","jeg ":"HSG",jest:"G0MLM6",jf:"D0GI02",jg:"D07L02",jk:"D2BF05I02L05","jk ":"D2B",jn:"D5II0BL0I","jn ":"D7O","jo ":"A43B0UG15H09",js:"D0BI0AL0Y",jt:"D08I1E",jv:"D0A",já:"B0LI3H",jä:"F1LG1I",jæ:"H08",jø:"H2I",jør:"H2P",kaa:"D0JGB7","kaa ":"G9I",kai:"G6LI0EM02","kan ":"D67FA6G1JH8PI0FM0M",kell:"903G2CIB9","ker ":"80A90PC02D2ZF7KHCUI05M09","ki ":"703A03B03C02G4MH02I5ZL5GM65",kj:"D04F05H2NI03",kje:"D05H2A",kjø:"H1J","kk ":"H29",kke:"D14G0YHEJI0PM07","kke ":"D06G02HNM",kla:"90GD0GF26G06H1TI04L0JM5A",kn:"825905D06F0TH0DI0TL0XM08",kno:"83L902D02L07M02",know:"86E",kom:"91ZD1MF6ZG0VH31I0ML17M0V",komm:"94HD03F6VG09H56I07",kor:"905D07F2CG1HH0FI4RL0KM1Q",ksi:"GAZH04L1LM14","ksi ":"GDQM05",kt:"91CD1YF2ZG05H2SI0UL2OM5D","kt ":"912D29F2SH17L0S",kte:"90ID0MF2LH1TI0CL03M4S",kv:"F0PH0II04",kw:"902D0HL0B",kä:"906F15G43",ké:"I52",kö:"90VF0ZG17I44M0Y",kı:"M4K","l'":"72VC2GM04","l'a":"76DC3D","lar ":"80F90DA2UB2WD08F5NH19J0JMAE",ları:"MBV",lc:"70280290EA08B03C14I0LJ0AL06M08",ldi:"807908A02C12D0AF1AH1MI04M5D",ldu:"902J06M9W",leri:"702905C02F02G03H06M97",lh:"702902B32F02G02H03I0Z",lho:"B5XI03","lig ":"90LD0KF2MH9JI0Q",lij:"D3EG0UI02J03L02",lijk:"D9Y",lik:"82U902D04F10G0TH2KI0IL0GM3S",lj:"D02F16G15H07I2A","lle ":"7IR931A0HC53D1AF5MGGRH9VM04",ller:"73080890YA08C0BD0MF3KG09H5OI05M0X",llä:"F03G91","llä ":"GDN",lma:"702A0AB0CC04D02F02G36I18J05MAM","los ":"70480490MAG6B1ID05G0ZI0AJ0JL02",lr:"807A02F06I0E","ls ":"74S80V92BD2BF0LH02",lui:"73BA04B06C4ED0FG0KJ8J","lui ":"74PB02C6WD03G04JD9",lw:"80BD02L09",lá:"A0AB0EI6D",lä:"90QF2SG4R","lä ":"F02GAF",lå:"F1FH0G",læ:"H0T",lé:"70XA0EB03I2X",lì:"C06",lí:"A0KB0EI0F",lö:"909F0XG0II0P",lø:"H0X",lă:"J26",lı:"M7Q","m'":"70N80CC02L02M4R","m'u":"M8S","m'un":"M8B",maa:"D2VG78M06","mai ":"702C40I0EJEE",mais:"782B8IG1H","mak ":"D02H04I02L03M8H",md:"903D0EF0AH02M20","med ":"80YF8WHB7I05",meg:"C0PH4LIEJL07","meg ":"HAXICL",mek:"G0NH03I0JL09M8Z","mek ":"I0CL0BM8F","mer ":"71C80G93SA1FB0YD23F6RH77I07L06M02",meu:"70GB59J2U",mig:"70580JA1WB2FC17D04F7FI02J03L03","mig ":"F9TI02",mij:"D3RJ06L03",mijn:"DA7",mind:"80J906B08D0DF0AH0CIE3M07",minä:"GB9","mit ":"708807979F0AG03ICJJ1M",mitä:"G9U",ml:"906D02F0HH0AI0JL05M1R",mma:"70F804902C0TD02F4UG1MH05I0H",mme:"77Z80E93PC0WD0HF58G7KH5KI0AM0A","mme ":"76190PC02D05F0CGAWH3U","mo ":"A6FB71CC8G0NL0K",moe:"B04D2V",mond:"72480F906C0OD0AIAYJ07","mos ":"AB3BAVI0HJ0Q",mt:"90QD0EF0RH0UI07J05L06",mui:"B6ZD02G19",muit:"B8EG09","my ":"835L7R",má:"A23B09I5K",már:"B03I4Q","már ":"I98",más:"A5TB0AI3O","más ":"A8QB0AI40",mã:"B0P",mä:"90DF0QG3S",må:"F1WH1W","må ":"F08H1N",mé:"70MA08B08I44",mí:"A0HB05I0H",mø:"H0J",mă:"J2Y",mı:"M5R","n'":"722866C0CM14","n't":"8BS","n't ":"8JF",naa:"D2MG1V",nagy:"IAD","nak ":"IGBL08M04",nb:"90BD0AF08H06I0OM02","nde ":"743931A3VB4IC1XD3MF69H3GJ4FM4K","ndo ":"804AE4BFICBZ",nek:"F02G0FH05IATL0FM0I","nek ":"ID8L0LM08",neke:"G03I9R","nem ":"93MB14ISGJ0AL0WM0F","nen ":"9DJA1AD8VF3KGKGH5FI0JM09",ngen:"70794GA06B04C07D4ZF60G03H78",nger:"72I812917C0PD1LF1RH6XI0QJ0B",nha:"802907B8LF02G0VI02","nha ":"B7WG0S",nho:"904B7KD02G0BI03",nich:"7029HRC02D02L0C","nie ":"70J91LC02D09F02I0ZJ17LSG",niet:"A03DLNL02","nin ":"F02G26M9Y",nlar:"M9D","nn ":"94SF0PH3EI06L02","nno ":"CA8L05",noe:"D0EH2ZM08",non:"71G804COCF02G0RI03","non ":"71ICSGG0LI07","nos ":"70UA7LB5TI14J0AL02",nou:"79980FB0SD02G0NJ1O",nous:"7CNG0U",now:"84JL2D","now ":"86W",nq:"70AA06B07C06",nsk:"F3EG2CH30","nte ":"73J92AAERBERCEGD0MFKMH2EI0OJ3S","nu ":"70YB02D0MF29G05JMAL0XMG5",nul:"708C0UG6OI1GJ48M03",null:"705902C1DGB4I03",nun:"90QA1LB28C08G6LI0EJ0YM94","nun ":"90AGAZM89","nut ":"D02F04GB6J0UL0BM02",nyt:"80MF08G5XH0AI0T","nyt ":"GA6I1M",nz:"91JA0FB02C1ND0CI0VJ09M08",ná:"B05I3E",nál:"I49",nã:"B64",não:"BLP","não ":"BOH",nä:"90BF1NG61","nä ":"GDF",nå:"F1PH1N",någ:"F4E",næ:"H09",nç:"707B0SM0N",né:"70UA07B02I3W",nó:"A08B0QI04L0B",nø:"H0I",nă:"J2E",nı:"M9X","nı ":"MBV","o'":"804C0AD05M05",oar:"804B07F04J9D",och:"714931A28B05C0AD0ZF6HJ0UL38","och ":"959D11F8NL03",ocê:"BH6","ocê ":"BHX",odo:"A4HB3GC0QG18I0GL1E","oe ":"802A02B03C02D1NG02H1P",oen:"B0FD1WF04G05H1L",oet:"A02B03C02D2FG08J02L02","of ":"876904B02D10",ogy:"803IC3","ogy ":"805INQ","oi ":"773B46C7MD07G5MJ5UL0D",oin:"72X832A03B02C03G5IJ05L03",oir:"75XG12",ois:"75N805A06B40C02G6MJ04L03",oit:"73EB1JD0TG7BJ03",oj:"A0JB0IF08G0RI04L4BM04",oldu:"I02MAA","ole ":"71I80I903A04B04C48D02GB2H0EL0P","oli ":"705C0VGAPI02J05L0L","olt ":"903F06H0AIBO","om'":"80OC07G02L04MBW","om'u":"M9Y","omi ":"B05C05F04GAUI5IL02M02",omm:"77880D924C0HD09F5NG1AH2UI0E",omme:"7AP80693JC0LD0HF5BG0FH6P","on'":"83XM23","on't":"86Y","ono ":"A0OB0GCJ3G0EL0E","ons ":"7BI81I902B09D2QF02","ont ":"7BI809902D0UF0JI13J06",oor:"80JD5G","oor ":"80VDB7",opp:"70980E902C1OD06F1OG1NH2TI02","oro ":"A0HB0IC8EG04L0D",orum:"902J05ME3","osa ":"703A24B18C8DG0CI08L04",oss:"71080K90CB4YC4SD04F1SG2WH1GI1L","ost ":"81Q905D0KF0DH0EI5IJBJL06M02",ostr:"A0JB0LCGKF03J0UL15","ott ":"90DF0UH08ICP","ou ":"71H8AJBHKD23J1E",oul:"72N84VG1AJ0O",ould:"88L","our ":"7CD85E",ous:"7K381UB04G0S","ous ":"7QP81LG07",out:"76K840B20D0BF02G0N","out ":"76186GD0P",ouv:"767B1AG03","ow ":"86KB02",owi:"806L8I",oy:"70G80EA1VM1K","oy ":"80CA5LM08",oz:"903A09B0DC0AD04I4BJ0BL2JM09","pas ":"7NKA0DB0ED0AF0OG06",pg:"D07H03","por ":"ACDB9GF04I02M0E",pou:"7AH803B1LG02",pour:"7DN803",powi:"L7U",prz:"LD2",prze:"LAN",przy:"L8S",pue:"A6S",pued:"A7I",py:"809G10L0NM02",pä:"908F03G2D",på:"F4UH4S","på ":"FCIH7D",pø:"H0F",pă:"J23","qu'":"77B",qua:"72G808903B8NC8V",que:"7LK80K904ANZBSDCB0","que ":"7OQ806ARCBRKC0W",quer:"70V903A28B88",ques:"73480LA0EB0DCBK",qui:"75S80PA81B5UC2J",qué:"70PA5C","qué ":"70RA7Y","r'":"804M04",rai:"79P810902A06B0XC1GG0KI04J08","rea ":"806A0GB04C06D02F02G02JC1",rec:"71780R91DA5CB72C0ZD0GF0GI03J4NL08M1H",rer:"71X80290YA0LB0QC0XD02F0JH2HJ0OM09","res ":"77K80K90SA8NB49D0GH18I0ZJ04L0AM02",rij:"B02D22J10",rj:"D02F0LG1JI10M03",rui:"70N804A0GB0EC7MD0SG03J0I",ruir:"704A05B04CBL","rum ":"926D04F0MJ0BL03MDZ",rw:"80390KD0EL10",rz:"912A06C05D0BI0MJ0ALDCM03",rze:"90LC03D03I0GLDD",rzy:"LAE",rà:"C0V",rá:"A1GB17I48",rä:"90MF2IG0U",rå:"F1VH0X",rè:"70U",ré:"71YA0UB04I1F",rí:"A2EB08I0C",ría:"A6MB0D","ría ":"A7S",rò:"C0U",ró:"A0NB0AI21L29",rö:"909F19G02I0T",rø:"H1H",rü:"918I13M2J",ră:"J4A","ră ":"J82",rı:"M7Z","s'":"70W802C05M04","s-":"71BB02I02J1E",saa:"B02G63M1K","sak ":"F0AI96M06",sco:"709808A0XB2WC4FD03J0VL02",sd:"902A08B03D06F04H05I0H",seg:"A1TB2UC2PF04H1XI1D",sei:"70Q947A09B2RC2HG1YH03I06J07","ser ":"73P80593KA2LB3FD05F2PH60I02L03M07",she:"855903D02F02G02I04","she ":"86Z",sic:"70380H93MA0RB0WC20J0KL02M02","sie ":"70E9FHC02D0KJ08L11","sin ":"70I803904A21F2TG9TH2PM5X",sinu:"GCBJ05",się:"LF3","się ":"LJI",sj:"D0EF0WH1JL06","sk ":"80HF1EH2OL04M02","ska ":"F8TG1UI0QL0J",ske:"80O902C02D03F18G2YH4SI09M0C",skj:"F0CH1O","sn'":"83H",sna:"802D04F1DH1QI0NL04M02","so ":"81B91ZA65BDOCBNG0IL04","som ":"B04F79HATI0R",sono:"B07CFS","ss ":"81Y94GF2LH1XI0F","ssa ":"709802B3KC1ZF0XGL5I0C",sse:"76S80V94CB7NC63D0VF0SG06H1RI0FM14","sse ":"74H91EB79C3YD06F02H1NI04","sso ":"BC7C7N",ssz:"I4N",ssä:"F02G6O","ssä ":"GAI","sti ":"B02C2UGA5I05M06","sto ":"905A4RB4RCCZF03G0FH0DL1C",stá:"A7LB8XI0A","stá ":"A81BA5",stä:"90EF2NG9I","stä ":"GB6","su ":"704A5WC0TG0DL12M0W",sunt:"A0AB09C04G08JEJ",sv:"903C0AD03F18G0BH13I04M02",sw:"80E906D03L1G",sz:"906INDLFB","sz ":"I7GL8Z",sza:"I4KL2O",sze:"903ID4L4V",szer:"IFSL06",szo:"I4BL0K",szt:"I4HL0Q",szé:"I4E",sá:"A03B07I2S",sã:"B10",sä:"907F1RG3S","sä ":"G8R",så:"F24H24","så ":"F41H35",sé:"70XA0KB05I3U",ség:"I4N",sì:"C0K",sí:"A0IB07I0Q",sö:"F0WG06I0NM42",söy:"M9A",söyl:"MAI",sø:"H0T",să:"JA3","să ":"JP5",sı:"M84",sın:"M92","t'":"70E81F902C03M02",taa:"904D1DGBNM02","taa ":"GD1",tai:"76K80KB0DC0PD02G4VI0CJ0N","tam ":"B0UIECJ09L1TM0W",tb:"802905A02D08F06H05I0QJ02M04",tc:"80FD02F02I05J04L06","ted ":"86VA1DH0FI39","tem ":"805909B6QD06IDHJ2NL51M02","tet ":"92XF28G09H5WI2CL03",tg:"907D09F02H02","th ":"70284YA02B02L02M02",tha:"7028DL904D02G06I0TM02",that:"8KNI1A","the ":"7028QB",ther:"70288H903D02",they:"86H",thi:"703891903M02",thin:"89L905",this:"86S",tid:"702A19B1GC07F3EH22J02M0A",tien:"71K807904A87C0DD0VF02G1HJ06","til ":"70680G902A0BB0DD08F04HFHJ07M04",till:"70981L907A0DD03FBDG0AH1A",tj:"D0IF0FH0BI0U",tk:"903D03F03G2YH02I0WL2BM0A",toi:"72GC0CG5SL04","tom'":"817G03L05MDE",tomi:"C02F03GIAI7HL04",tos:"704903A41B4RC0ZG2FI1UJ07L07M05",tou:"78F807B5UG06","tre ":"7EE802A17B12C3KF1VH24I0NJ3HM06",treb:"903C0NJC8",trui:"70GA09B08CBPD05J0B","ts ":"75S83C913D1RF16H0EI09","tt ":"90PFO9H70IEH",tta:"70E805906C4WF5UGDTH04I3EM0L","tte ":"76080294LC2ZD1BF0UG3BH96I4BM0G",tti:"70780J902C55D06F0RG6YH0HI05M72",tto:"707804CB1F0AG1UH04I03","tto ":"CEAF02G0B",ttä:"902GCR","ttä ":"GDI","tu ":"7BBA2PB0RC2AG1QJ1EL2HM1M",tw:"80E90YD0SL2N",tz:"92DD05",tà:"C1H","tà ":"C5K",tá:"A2IB2DI5A","tá ":"A5CB8H",tã:"B11",tä:"90IF1GGF4","tä ":"GNT",täm:"F0IG61",tämä:"G9W",tää:"GA5","tää ":"G9V",tå:"F0XH0U",té:"721A0EB0EI4Z","té ":"773A0UB19",tò:"C05",tó:"A0QB0AI2HL1I",tö:"905F0CG0WI38M03",tø:"H0F",tă:"J68","tă ":"JG5",tı:"M71","u'":"71I80O",ual:"70480M902A18B2AC4TG02J0FL05",uan:"71SA2RB57C3AG1PH05M03",uch:"71481793NA4AD0AL1F",ued:"804A6CB04J02",uer:"71M90QA5RB75C0AF02H05",ues:"72N80J904A3DB0FC7IG04H02",uest:"71180NA4BB09CBJG02",ugh:"82V902J05",uh:"70290LG1QH02I0CM0J","ui ":"786A0CB3SC6WD02G2LJBB",uie:"70H803A5PB03J59",uir:"70M804A0MB0OC7PG02J03",uire:"70S805B02CBP",uis:"76N803A0LB0XC07D1FG21",uit:"72L80KA0IB75C0BD2MG0LJ3E",uito:"A06B7BC0AJ06",uld:"84T90DB07D0BF07M1F",ull:"70580F902A09C1KD1NF48G93H1QI09M1D","uma ":"A06BD8C02G0EI02J09M0H",una:"703805903AA9B07C7TG2CI06J2TM1P","una ":"AE3B04CBLG1DJ3EM1L","und ":"81R9C1F1DH0SJ09",une:"7AJ805908A0AB02C0LG0ZH03J4QL05","une ":"7FQ804904C0EJ3S",unk:"80690EF0DG0OH07I58L0IM02","unk ":"808I9F",unn:"807902C07D0NF14G33H27","unt ":"80A902D1HF0DJD4",unu:"G1QJ1CMEA","unu ":"G02J06MC2",uo:"70IA03B03C3JG58L02",utt:"70380690HC4WF0IG78H17I02M0K",uu:"D0RG5F",uw:"D1ZL0Q","ux ":"7A6",uy:"70280CA12M3V",uz:"903A07B09C04D07I04J10L0GM2X",uá:"A0MI02",ué:"70DA20B0H","ué ":"715A5F",uí:"A0OB06",uò:"C0C",uğ:"M3G",uğu:"M8G","v'":"C04",vad:"A0DB0IC2ED0DF5DI0CJ0BM05","vad ":"F6YI03",vag:"706A03B08C08F04I5VJ02",vagy:"IDS",vai:"76E802A03B2QC2BG67I03","van ":"A0MDGZF06G4GIGPJ05M05","var ":"A0KB0RFCEHAII06M72","vat ":"D06F04GCVI05J0VM05",vd:"F06H09M0L","ver ":"72084M904A29B35C0LD4NF4ZH5UI05J05M12","vet ":"F3TG05H5JI2CM0L","vil ":"804A06B02H7M",vill:"717805A0AC05F68G0NH2HI0F",vl:"D0FF0BH03M0K",vn:"F03H0GI04","vo ":"A2HB2SC51G03",voc:"705A0EBH9C0DD02J0D",você:"BJX",voi:"75I806C2DG7OJ50",volt:"B1KC21D02IDFJ08",voo:"B04D34G02",voor:"DB7",vor:"706807921A1MB23C4UD0BF0JH3IJ4EM04",vou:"7E5804B2LD02",vous:"7JG805",vr:"712B0MC0PD1PF04H02I02J1TM0I",vv:"C0GI03",vá:"B07I3Y",vä:"F3EG46",vå:"F15H0L",væ:"H1T",vær:"H2W",vé:"70KA03B02I2Z",waa:"D2P",waar:"D93",wan:"83890OD0ML2P",war:"80M93ZC02D0QL1A",was:"87K93ND2PL0G","was ":"8BP97SD9DL0A",wat:"80OD2TL08","wat ":"D93L03",wd:"D06L18","we ":"835D30L1J",wee:"70480QC04D2KJ03L04",wh:"84L",wha:"83GB02",wie:"937D0PLE2",wil:"821914D23L0O",wir:"94UL02",wit:"83S904D06L0B",with:"86O",wn:"80OL1S",wo:"83292CD24L5L",wr:"80EL0T",ws:"80FD03L33",wy:"L6E",xa:"704805A05B0KD02F05J05",xc:"704805A04B03J03",xp:"70680FA0AB09J0A",xt:"70380D902A0CB06F05J04","y'":"80HM2E",yap:"I05MDO",yb:"809I0GL1FM0E",yc:"803F2FL3XM02",yck:"F6T",ycke:"F6Q","ye ":"703804A05H1LI0SM7Z",yg:"F0IH0FI04L14M0D",yh:"F02G17I09",yi:"80KG0NI2CM64","yi ":"G16I0UM9T",yk:"F06G1CH14I09L1ZM09",yle:"707804G0LI0DL0CMB8",ym:"702807902F07G12H05I0DL53M0D",yor:"702802A0OB02C02F03G03I0MJ03MRC","yor ":"A0JMH0",yoru:"MF8",you:"7028DI","you ":"8HL",yt:"80JF0FG41H0QI16L22","yt ":"F02G6BH03I0XL0R",yv:"F02G1DH04I0UM07",yy:"G1C",yö:"G1VI0AM06",yı:"M4L",ył:"L4H","z-":"70S","ze ":"70780A90QB0AC0OD4ZI0YJ1FL6VM2C",zer:"80290BB5YC09D03I6YJ08L11M1C",zere:"B02IAGM0A",zie:"90RC19D1PJ0DLCA",zij:"D5P",zijn:"DGG",zio:"B02C7OL0E",zion:"CALL08",zt:"916I8EL0J","zt ":"918I70",zu:"964A03B02C02D0II0UJ0SL22M0T","zu ":"95XL0KM0D",zw:"90RD0EL1Z",zy:"802LEPM06","zy ":"804LA5",zá:"A02I3U",zé:"I3I",ß:"90P",ße:"910",à:"71SB0EC13","à ":"73TB0QC2N",á:"A2OB2SIDM","á ":"A2NB46I11",áb:"A05B03I2U",ág:"A03B0AI37",ál:"A09B07I9K",án:"A1AI66",ár:"A08B0OI8U","ár ":"I55",ás:"A2HB0EI5X","ás ":"A7NB16I3G",át:"A06B06I77","át ":"I6B",â:"706B04J34M0B",ân:"B09J3Z",ã:"B4L","ã ":"B0I",ão:"BA3","ão ":"BS0",ä:"91MFDYGMG","ä ":"F02GKQ",äg:"907F1J",äh:"90SG1S",äi:"G2M",äk:"F0OG1G",äl:"90IF3OG2M",äm:"905F0ZG2C",ämä:"G6Z",än:"90ZF5FGBF","än ":"F2NGNO",änd:"90PF3P",äne:"903G67",är:"90QFFXG1K","är ":"FRUG03",äs:"90BF1AG2E",ät:"90YF2FG2Y",ätt:"90MF4NG23",äv:"F0BG1F",äy:"G20",ää:"G7Z","ää ":"GB6",ään:"GBF","ään ":"GGF",å:"F8XH5K","å ":"F7PHDU",åd:"F0KH0G",åg:"F2T",ågo:"F41",åk:"F0SH0I",ål:"F17H0J",ån:"F2PH0I",ång:"F43",åp:"F02H0F",år:"F33H3Q","år ":"F69H4L",ås:"F15H05",åt:"F1MH0Z",æ:"H0V",ær:"H3E",ære:"H2U",ç:"70IB1HM61","ç ":"M3F",ça:"70WB1GM3B",çi:"M5A",çin:"MAH","çin ":"MAR",ço:"706B0OM4H",çok:"M95","çok ":"MA9",çã:"B18",è:"71AC2O","è ":"C6A",èr:"719",ère:"764",ès:"70R","é ":"74LA3LB5BC0ZD02F04I0W",éc:"718A03B04I02",ée:"71I","ée ":"75J",ég:"70BI6T","ég ":"I55",ék:"I32",él:"70IA1WI6U","él ":"A5YI3F",ém:"70AA02B0SI14",én:"70AA0RD05H03I61",ép:"70PI2H",ér:"714A08B0AI81",ért:"I5V",és:"711A13B07I7V","és ":"72RA34B0MI6O",ét:"728A03B03I45",ê:"70WB2M","ê ":"B43",ên:"B0I",ês:"B1J","ês ":"B6H",êt:"71I",ë:"D05","ë ":"D0B",ì:"C0F","ì ":"C10",í:"A2XB0XI2F","í ":"A1ZB03",ía:"A4PB05","ía ":"ABLB02",íc:"A0DB0F",ít:"A05B04I3K",î:"707J50",în:"703J9M","în ":"JFS",ñ:"A0X",ña:"A13",ño:"A1H",ò:"C0T","ò ":"C1Z",ó:"A2SB0YI3TL4P","ó ":"A41B0FI3D",ól:"A0AB04I3BL0G","ól ":"I4SL0C",óm:"A0JI07",ón:"A33I0I","ón ":"A8FI07",ós:"A03B0VI0OL08",ô:"707B06",õ:"B07",õe:"B0I",ö:"915F7KG2BI4TM3Z","ö ":"F06G1A",ön:"915F0OG0LI3MM2G",ör:"90WF98G08I2SM3B","ör ":"903FBII0EM09",örs:"902F3R",öv:"F1QG02I12M04",öve:"F47I11",öy:"G0IM43",öyl:"MAC",öyle:"MAX",ø:"H33",ød:"H0Z",øk:"H0S",øl:"H0S",øm:"H0G",øn:"H11",øp:"H0P",ør:"H4D","ør ":"H27",øre:"H2H",øs:"H0R",øt:"H0Q",øv:"H0M",øy:"H12",ù:"706C0E","ù ":"70DC0X",ú:"A0KB0CI1I",ún:"A0KB05I04",û:"706",ü:"924I2XM80",üb:"91HM03",üc:"915M0C",ül:"908I4UM18",ün:"90LI2GM7P","ünk ":"I97",ür:"926I0CM3B",ă:"JGA","ă ":"JN9",ăr:"J36",ăt:"J1W",ą:"L5Z","ą ":"L82",ć:"L55","ć ":"LC4",ę:"LAM","ę ":"LHC",ğ:"M63",ği:"M95",ğin:"M8G",ğu:"M3T",ğı:"M5K",ı:"MIA","ı ":"MJR",ık:"M4Q",ıl:"M4N",ım:"M8D","ım ":"MEZ",ın:"MFG","ın ":"MFK",ınd:"M9C",ında:"MA4",ını:"MD9","ını ":"MB3",ır:"M6S",ıy:"M5K",ıyo:"MAH",ıyor:"MBU",ız:"M4Y",ış:"M42",ł:"LD6","ł ":"L9M",ła:"L7F",łe:"L66",łem:"L8V","łem ":"LCC",ło:"L5O",ń:"L11",ő:"I3H","ő ":"I36",œ:"704",ś:"L5Z","ś ":"L4S",ş:"J0HM73",şa:"J03M3L",şe:"J03M4F",şı:"M3O",ţ:"J0J",ű:"I0Q",ź:"L0Q",ż:"L6C",że:"L6F","że ":"L97",ș:"J4G",și:"J3U","și ":"J9Z",șt:"J4E",ști:"JAL",ț:"J47",ți:"J78","ți ":"JDV","̇":"M0I",а:"KPL","а ":"KQP","ает ":"K8F",ал:"KFF","ал ":"KEI",ать:"KHM","ать ":"KJY",б:"K8X",в:"KGE",во:"KDH",г:"K7J","гда ":"K8F",го:"KFL","го ":"KIF",гово:"K7T",д:"KDR","да ":"KBW",де:"KEC",дел:"KBG",дела:"KAA",е:"KQR","е ":"KSG","ебе ":"K7E",его:"KD0","его ":"KEP","ему ":"K8J",ен:"KFZ","еня ":"K9Q",ет:"KEY","ет ":"KH9","ешь ":"K8B",ж:"K55",з:"K7K",и:"KLO","и ":"KOL",ит:"KEI",ить:"KBZ","ить ":"KDO",й:"K5A","й ":"KFB",к:"KCN",ка:"KDZ",каза:"K8T","как ":"K8Q",ко:"KFV",л:"KH7","л ":"KFG","ла ":"KBG",ли:"KD3","ли ":"KFU",м:"KGY","м ":"KLY",меня:"KA4","мне ":"KD2","му ":"KB9",мэри:"K7J",н:"KNA",на:"KM8","на ":"KL5",не:"KO8","не ":"KSF",ни:"KGM",но:"KGF","но ":"KH9",о:"KSG","о ":"KSG",ов:"KD4",овор:"K7V",огда:"K7L","ого ":"KC5","ой ":"KE1",ом:"KKG","ом ":"KOQ",он:"KEA","он ":"KC6","она ":"K9G",ост:"KD5",п:"KBR",по:"KKF",пр:"KE6",про:"KDL",р:"KG0",ра:"KHG",ро:"KEM",с:"KJD",сказ:"K7O",ст:"KJO","сть ":"K7P","сь ":"KC0","ся ":"KIV",т:"KPL","т ":"KHV",та:"KD7",те:"KG3","те ":"KCM",то:"KSA","то ":"KRY",том:"KOJ","том ":"KO7","тся ":"KC4","ты ":"KFY",ть:"KIB","ть ":"KR5",у:"KCT","у ":"KIJ",ф:"K0T",х:"K3O",ц:"K1K",ч:"K84",что:"KKH","что ":"KLT",ш:"K4M",щ:"K19",ъ:"K05",ы:"K9R","ы ":"KJX",ь:"KAJ","ь ":"KP3","ься ":"K8D",э:"K3E","эри ":"K7I",это:"KJ4","это ":"KIC",ю:"K3E",я:"KBD","я ":"KRD",ё:"K2N","​":"207",一:"2H5",不:"2I1",不知道:"2DC",了:"2N1","了 ":"2I3",人:"2AJ","什么 ":"2E0",什么时候:"2Q1",他:"2JJ",你:"2K8","吗 ":"275","嗎 ":"25T",在:"2FQ",她:"29M","工作 ":"2C6",我:"2SG",我不知道:"2SG",我们:"27C",我的:"26P",是:"2JR",有:"2E7",汤姆:"27V",的:"2S3","的 ":"29E","的时候 ":"2RL",要:"28S"},uniques:{" aan":"d"," aic":"j"," aik":"g"," aiu":"c"," ao ":"b"," aos":"b"," as-":7," até":"b"," auf":9," auz":"j"," aí":"b"," aú":"a"," cee":"j"," chc":"l"," cs":"i"," ctr":"k"," cu ":"j"," cua":"a"," cóm":"a"," daa":"d"," dl":"l"," dzi":"l"," där":"f"," dår":"h"," dés":7," día":"a"," dón":"a"," död":"f"," ea ":"j"," ear":8," eat":8," een":"d"," eft":"f"," elä":"g"," em ":"b"," epl":"h"," etm":"m"," etw":9," ez ":"i"," ezt":"i"," fez":"b"," fi ":"j"," fiq":"b"," fje":"h"," gaa":"d"," gi ":"h"," gic":"f"," gik":"h"," gje":"h"," gân":"j"," göz":"m"," hje":"h"," hoz":"i"," htt":"k"," hv":"h"," há ":"b"," hâl":"m"," hög":"f"," i'":8," i-":"j"," iar":"j"," ied":"d"," iet":"d"," if ":8," iga":"i"," igj":"h"," ihn":9," iht":"m"," ik ":"d"," ilg":"m"," ilm":"g"," ils":7," ily":"i"," isn":8," it'":8," iub":"j"," iy":"m"," iş":"m"," já ":"b"," kje":"h"," ks":"l"," kt":"l"," kuo":"g"," kuu":"g"," kå":"h"," l-":"j"," lh":"b"," lj":"f"," lle":"a"," luu":"g"," lá ":"b"," låt":"f"," m'a":7," m-":"j"," mj":"f"," mni":"l"," muj":"a"," mè":7," n'a":7," n-a":"j"," ne-":"j"," når":"h"," nós":"b"," oam":"j"," ock":"f"," odp":"l"," og ":"h"," ogg":"c"," ogs":"h"," ohn":9," oik":"g"," olh":"b"," olm":"m"," op ":"d"," oth":8," oí":"a"," pe ":"j"," päi":"g"," rz":"l"," s'e":7," s-":"j"," sb":"c"," sd":"c"," sg":"c"," sje":"h"," szc":"l"," szü":"i"," te-":"j"," tiv":"b"," tym":"l"," työ":"g"," täm":"g"," tè":"c"," töb":"i"," tú ":"a"," túl":"i"," ucc":"c"," un'":"c"," uo":"c"," up ":8," usc":"c"," usk":"g"," v-":"j"," veu":7," vri":"d"," vro":"d"," vän":"f"," way":8," wij":"d"," wo ":9," ws":"l"," wur":9," xí":"b"," yh":"g"," yk":"g"," yl":"g"," ym":"g"," yri":"g"," ys":"g"," yü":"m"," za ":"l"," zas":"l"," zaw":"l"," zd":"l"," zi ":"j"," zij":"d"," zm":"l"," zn":"l"," zo ":"d"," zos":"l"," zr":"l"," zu ":9," |":6," ° ":"c"," ½":9," áll":"i"," án":"a"," äls":"f"," än ":"f"," är ":"f"," äta":"f"," äte":"f"," åk":"f"," åp":"h"," åt ":"f"," ça ":7," çal":"m"," ço":"m"," è ":"c"," é ":"b"," ért":"i"," éta":7," été":7," éx":"a"," éé":"d"," ír":"i"," îm":"j"," în":"j"," ôn":"b"," önc":"m"," öpp":"f"," öss":"i"," úg":"i"," új":"i"," ō":9," şe":"m"," şi ":"j"," şt":"j"," ।":6," २":6," ঈ":5," ঋ":5," ঔ":5," ৩":5," ৪":5," ৬":5," ৮":5," ―":"k"," ‟":9," №":"k"," ご":1," ウサギ":1," エレベ":1," コ":1," ジ":1," テ":1," ド":1," ネズミ":1," バ":1," パ":1," フ":1," ボ":1," マ":1," メ":1," 一人":1," 一日":1," 一般的":1," 不好意":2," 両親":1," 中国語":1," 二人":1," 交通事":1," 今 ":1," 今夜":1," 今度":1," 今晩":1," 今朝":1," 今週末":1," 他一":2," 他不":2," 他人":1," 他可能":2," 他在":2," 他把":2," 他有":2," 会議":1," 何時":1," 俺":1," 僕":1," 先週":1," 列車":1," 労働者":1," 北海道":1," 午前中":1," 博物館":1," 合衆国":1," 君":1," 因為":2," 地下鉄":1," 基本的":1," 外国":1," 多分 ":1," 大学":1," 大家":2," 如":2," 子":1," 実際":1," 宿題":1," 富士山":1," 少年":1," 心配":1," 我今":2," 我从来":2," 我从没":2," 我以":2," 我会":2," 我叔叔":2," 我只":2," 我可":2," 我和":2," 我哥哥":2," 我喜":2," 我妹妹":2," 我完全":2," 我就":2," 我希":2," 我弟弟":2," 我必須":2," 我必须":2," 我感觉":2," 我打算":2," 我把":2," 我无法":2," 我明":2," 我昨":2," 我更喜":2," 我最近":2," 我正在":2," 我没":2," 我無法":2," 我父":2," 我爸爸":2," 我現在":2," 我相信":2," 我看":2," 我知":2," 我能":2," 我覺得":2," 我觉":2," 我認為":2," 我认":2," 我讨厌":2," 我需":2," 我非常":2," 所以":2," 所有":2," 放課後":1," 政治家":1," 新聞":1," 旅行":1," 日曜":1," 昨夜":1," 是的 ":2," 時々 ":1," 晩ご飯":1," 最初":1," 最近 ":1," 最近彼":1," 月日":1," 有些人":2," 来週":1," 残念":1," 湯":2," 現在 ":1," 看護婦":1," 私":1," 科学者":1," 突然 ":1," 結婚":1," 結局":1," 萨米":2," 請":2," 警察官":1," 谢谢 ":2," 這":2," 那":2," 電話番":1," 電車":1," 風邪":1," 飛行":1," 갈 ":3," 같":3," 걱정":3," 걸":3," 결국 ":3," 결혼":3," 경찰":3," 계속":3," 곧 ":3," 공":3," 과학":3," 괜찮":3," 궁금":3," 날":3," 남":3," 넌 ":3," 널 ":3," 네":3," 년 ":3," 노래":3," 노력":3," 누":3," 당":3," 대":3," 더":3," 동":3," 돼 ":3," 되":3," 될 ":3," 두 ":3," 둘 ":3," 때":3," 떠났":3," 또 ":3," 많":3," 먹":3," 메":3," 몇 ":3," 모":3," 몰랐":3," 못":3," 문":3," 뭘 ":3," 미":3," 바":3," 방법":3," 배":3," 번역":3," 벌써 ":3," 본 ":3," 볼 ":3," 봐 ":3," 부":3," 비":3," 살":3," 새 ":3," 생":3," 선생":3," 소":3," 싶":3," 알":3," 언":3," 엄청 ":3," 영":3," 오":3," 완전":3," 왜":3," 운전":3," 음식":3," 음악":3," 잘":3," 재미":3," 저":3," 적":3," 전":3," 절대":3," 점심 ":3," 정":3," 조금":3," 좀":3," 죄송":3," 줄 ":3," 중":3," 줘 ":3," 진짜":3," 질문":3," 집":3," 참 ":3," 처음 ":3," 친구":3," 침대":3," 커피":3," 컴퓨":3," 큰 ":3," 텔레비":3," 파티":3," 프":3," 학교":3," 학생":3," 할":3," 함께":3," 항상":3," 행복":3," 훨씬 ":3," -":9,"'ae":"c","'ai ":7,"'aim":7,"'cl":8,"'d ":8,"'da":"m","'e-":"c","'ea":7,"'eb":"c","'ell":7,"'ep":"c","'eq":"c","'fb":"c","'ha ":"c","'ho ":"c","'hu":7,"'il ":7,"'j":"d","'k":"d","'ll":8,"'ni":"m","'on ":7,"'ou":7,"'ov":"c","'re ":8,"'uc":"c","'uf":"c","'ug":"c","'une":7,"'uo":"c","'uv":"c","'ve":8,"'y ":7,"'ye ":"m","'yi":"m","'à":7,"'á":"b","'â":7,"'è ":"c","'é":7,"'ê":7,"'î":7,"'ü":"m","(-":"k","(q":"b","(y":"a","(z":9,"-$":"n","-'":"m","-ai ":"j","-am ":"j","-ar ":"j","-au ":"j","-ce ":7,"-ell":7,"-il ":7,"-je ":7,"-l ":"j","-lh":"b","-lo ":"b","-là":7,"-me ":"b","-mi ":"j","-moi":7,"-t-":7,"-tu ":7,"-ul":"j","-vou":7,"-à":7,"-ã":"b","-ê":7,"-í":"b","-ó":"i","-ö":"i","-ş":"j","a'd":"m","a'y":"m","aag ":"d","aak ":"d",aakt:"d","aam ":"d",aav:"g",abg:9,acj:"l",acz:"l",adei:"b",afí:"a",agte:9,"agy ":"i",ahd:"g","ahr ":9,aike:"g",aior:"b","ais-":7,aiut:"c",aixo:"b",ajud:"b",alál:"i",amay:"m",ambé:"b","an't":8,apm:"m",aquí:"a",ardz:"l",areb:"c",arfö:"f",arum:9,arü:9,arş:"m",aszt:"i",atok:"i",atât:"j",aufe:9,augh:8,auj:7,autt:"g",avea:"j",avev:"c",avne:"h",avve:"c",avô:"b",ayac:"m",ayud:"a",ayó:"a",azla:"m","azt ":"i",azón:"a",azú:"a",aá:"i",aã:"b",aä:"g",aî:7,aö:"i",aún:"a",baix:"b",baş:"m",berä:"f",besz:"i",bge:9,"biz ":"m",bién:"a",blij:"d","bly ":8,brz:"l",brí:"a","bst ":9,buie:"j",bunu:"m",buon:"c",buu:"d","bym ":"l",bã:"b",bäs:"f",bäu:9,"bè ":"c",bém:"b","bí ":"a","bía ":"a",bî:7,bô:"b",börj:"f",bù:"c",büc:9,"c'es":7,"c'è":"c",cche:"c",ccia:"c",cció:"a",ceea:"j",cepu:"j",chce:"l",chg:9,chk:9,chod:"l",chä:9,chí:"a",chö:9,chü:9,ciod:"j",ciun:"j",ciut:"c",cji:"l",ckan:"f",cma:"j",cois:"b",coj:"a",colh:"b",conh:"b","cos'":"c",csa:"i",cse:"i",csi:"i",cuan:"a",cuch:"a",cuel:"a",cuen:"a",cug:"c",cuie:"j",cuol:"c",cuá:"a","cz ":"l",czas:"l","cze ":"l",czeg:"l",czek:"l",czn:"l",czo:"l",czu:"l",czy:"l",câi:"j",câm:"b",cât:"j",cã:"b",cä:9,cç:"b",cên:"b","cí ":"a","d'h":7,"d'v":8,"d'è":"c","d)":8,daag:"d",daar:"d",daq:"b",davv:"c",daví:"a",daş:"m",ddl:8,degl:"c",deia:"b",dein:9,deir:"b","deu ":"b",deut:9,dey:"m",didn:8,dijo:"a",dinh:"b",dly:8,"dn'":8,"don'":8,dovr:"c",dovu:"c",drik:"h",drz:"l",drí:"a",drü:9,"dta ":"i",dtam:"i","du-":"j",duw:"d",duy:"m","dzi ":"l",dzia:"l",dzie:"l",dzis:"l",dzo:"l",dzy:"l",dà:"c","dá-":"b",dã:"b","dä ":"g","dän ":"g",dät:"g","då ":"f",dål:"f",dè:7,dép:7,dê:"b","dí ":"a","día ":"a",días:"a",dîn:7,dô:"b",dörr:"f",dúv:"b",dû:7,"dü ":"m","dün ":"m",dō:9,"e'r":8,"e'v":8,eady:8,easc:"j",eaun:"j",eave:8,ebè:"c",ecek:"m",eceu:"b",ecir:"a",ecv:"j",ediy:"m",edzi:"l","eea ":"j",eeft:"d",efd:"d",egou:"b",egé:"i","ehe ":9,"ehr ":9,ehs:9,"eht ":9,einm:9,"eio ":"b",eix:"b",ejor:"a",ejó:"a","ekk ":"h",elbs:9,eliy:"m",ellä:"g",elq:7,emey:"m",emiy:"m",emps:7,"emu ":"l","en't":8,enx:"b",enía:"a",eopl:8,eoz:"c",epoi:"b",epui:7,erug:"d","es-t":7,"es-v":7,"esc ":"j",esoi:7,eszc:"l",euch:9,eux:7,"ev'":"c",evn:"h",ewh:8,eyec:"m","eyi ":"m","ezt ":"i",ezte:"i",ezza:"c",ezó:"a",eã:"b","eä ":"g",eça:"b","eço ":"b",eë:"d","eí ":"a",eía:"a",eíb:"a",eíd:"a",eî:"j",eïn:"d",eón:"a",eû:7,"e‘":9,"fa'":"c",fap:"j",faut:7,fazl:"m","fd ":"d","fde ":"d",fds:"d",feel:8,fej:"i",few:8,ffn:9,fft:9,fiec:"j",figl:"c",fikk:"h",filh:"b",flé:7,foar:"j",fois:7,forh:"h",frum:"j",frå:"f",frè:7,frü:9,fuer:"a",fuo:"c",fà:"c",fâr:"j",fã:"b",fäh:9,fåg:"f",fç:"m","fè ":"c",fèr:7,fía:"a",fô:"b",förs:"f",förä:"f",fû:7,füh:9,"g)":8,gaat:"d",ganh:"b",gdy:"l",gdz:"l",gece:"m",geef:"d",geht:9,gesa:9,geï:"d",ggh:"c","ggi ":"c",ggia:"c",ggs:8,ghb:8,ghl:8,giap:"c",gick:"f",gikk:"h",gioc:"c",giov:"c",gitm:"m",gjer:"h",glei:9,glez:"j",glio:"c",glöm:"f",glü:9,goed:"d",gof:"c",good:8,"gou ":"b",gråd:"h",grü:9,gså:"h",gth:8,guf:"c",guma:"b",guv:"j",gye:"i",gyi:"i",gynn:"h",gynt:"h",gyo:"i",gysz:"i","g ":9,gând:"j",gã:"b",gåe:"h",gån:"f",gè:7,gée:7,gía:"a",görm:"m",görü:"m",gù:"c","gún ":"a","gün ":"m",güz:"m","h)":9,hace:"a",haci:"a",hagy:"i",hci:"l",hdä:"g","he'":8,hear:8,hebb:"d","hed ":8,heef:"d","hey'":8,hiam:"c","hij ":"d",hijo:"a",hjem:"h",hjer:"h",hlen:9,hlt:9,hly:8,hlä:9,hnen:9,hnl:9,"ho'":8,hodz:"l",hogy:"i",homb:"a",houd:"d",houg:8,hoy:"a","hoz ":"i",hoş:"m",hrer:9,hrh:9,hrl:9,hrs:9,hrt:9,"hst ":9,http:"k",htä:"g",huo:"g",huvu:"f",huw:"d",hvé:"a",hyv:"g",hár:"i",hã:"b","hän ":"g",häne:"g","här ":"f",hål:"f",hån:"h",håp:"h",hç:"m","hí ":"a",hís:"a",hív:"i",hô:7,höv:"f",hō:9,hş:"m","h‘":9,"i'l":8,"i'm":8,"i'v":8,iacc:"c",iagg:"c",iapp:"c",ibt:9,icz:"l",idzi:"l",idä:"g","iec ":"l",iedy:"l",iedz:"l","iej ":"l",iejs:"l",ielä:"g",igje:"h",igk:9,igvi:"h",igå:"f","ihm ":9,ihmi:"g","ihn ":9,"ihr ":9,ihå:"f",iic:"j",iik:"g",iim:"g","iin ":"g",ijb:"d",ijd:"d",ijf:"d",ijg:"d",ijh:"d","ijk ":"d",ijke:"d","ijn ":"d",ijp:"d",ijt:"d",ijv:"d",ijz:"d",iliy:"m",ilye:"i",incs:"i",inál:"i",iní:"b",ioda:"j",ious:8,ioè:"c",irim:"m",irj:"g",irkl:9,"is-j":7,issz:"i",isä:"g","it's":8,"iu-":"b",iua:"j",iuc:"c",iune:"j",iuo:"c",iusc:"c",iuto:"c",ivät:"g",ixar:"b",iye:"m",iyi:"m",iyo:"m",izio:"c",ià:"c",iã:"b","iä ":"g",iça:"b",iço:"b",ièm:7,iée:7,"ién ":"a",iê:"b",ië:"d",ií:"i",iô:"b",iù:"c",iü:"i","iş ":"m",işe:"m",işi:"m","j'":7,"j-":"i",jaar:"d","jag ":"f",jahr:9,jds:"d",jdt:"d",jedz:"l","jeg ":"h",jego:"l",jelp:"h",jert:"h",jetz:9,jeun:7,"jf ":"d",jft:"d","jg ":"d",jge:"d",jgt:"d",jij:"d",jj:"i",jkh:"d",jks:"d",jkt:"d","jl ":"d",jls:"d",jnl:"d",jns:"d",jnt:"d",joit:"g",jota:"g",joue:7,"jp ":"d",jpe:"d",jpt:"d",jull:"d",juo:"g",juu:"g",jze:"d",jzi:"d",jà:7,jár:"i",ját:"i",jã:"b","jä ":"g",jälv:"f",jå:"h","jé ":"a",jól:"i","kaa ":"g",kauf:9,kijk:"d",kims:"m",kiş:"m",kjed:"h",kjel:"h",kjem:"h",kjen:"h",kjer:"h",kkä:"g",knew:8,know:8,kolm:"g",komt:"d",ksj:"h",kså:"f",kuin:"g",kvel:"h",kvä:"f",kâ:"m","kä ":"g",känd:"f",käv:"g",kåt:"h",kç:"m",kép:"i",kér:"i",kés:"i",két:"i","kö ":"g",köny:"i",köz:"i",kú:"i",kû:"m",kō:9,kş:"m","l'f":"c",laub:9,laş:"m",lbst:9,lcos:"c",lcun:"c","ldu ":"m",left:8,letz:9,"lf-":8,lfd:"d",lgd:"d",lgoz:"i",lgui:"a",lgum:"b",lgú:"a",ligv:"h",lijk:"d",liw:"l",lkä:"g","ll'a":"c","ll'e":"c","llä ":"g",lmay:"m",lmiy:"m",lox:"c",lsj:"d",ltc:"j",ltij:"d",ludz:"l",lvf:"h",lví:"a",lway:8,lyck:"f","lz ":9,lâng:"j",lã:"b",lära:"f",låd:"f",låg:"f","låt ":"f",lè:7,lên:"b","lí ":"a",lía:"a",lû:7,"m'u":"m","m'è":"c","m-v":"b",mawi:"l",mbié:"a","mdi ":"m",megt:"i",megy:"i",mehr:9,meir:"b",mejo:"a",melh:"b",meye:"m",meyi:"m",miei:"c",migh:8,migl:"c",mijn:"d","miz ":"m",miè:7,miş:"m",mjö:"f",mmt:9,mmä:"g","mo-":"b",moet:"d",moje:"l",mq:"c",mulh:"b",muut:"g","muy ":"a",myck:"f",mye:"h",myö:"g","m ":"b",mâi:"j",mânc:"j",mã:"b","mä ":"g",mås:"f",måte:"h",mèr:7,mée:7,mêm:7,"mí ":"a",mía:"a",mój:"l",möc:9,mún:"a",mû:7,müss:9,mş:"m","n'ai":7,"n'd":"m","n't ":8,"n'y":7,"n'è":"c",nagy:"i",namn:"f",nauc:"l",nció:"a",nehm:9,neue:9,next:8,nft:9,nfí:"a",nhec:"b","nho ":"b",nhv:"h",niej:"l",niin:"g",niy:"m",niè:7,nká:"i",nly:8,nnhe:"h",nnr:"h",nnsk:"h",nnst:9,"nnt ":9,nnte:9,nnå:"h",nodi:"d",nooi:"d",noth:8,nouv:7,"now ":8,noë:7,"nq ":7,nskj:"h","nu-":"j",nuev:"a",nung:9,nuov:"c",nuw:"d",nuş:"m",nvän:"f",nych:"l",nyel:"i",nyth:8,nyv:"i",nyá:"i","nz'":"c",nzio:"c","n­":9,"nál ":"i",nã:"b","nä ":"g",näi:"g",näk:"g",någ:"f","når ":"h",nçai:7,nças:"b",nè:7,née:7,nék:"i",néz:"i","nía ":"a",níc:"b","nós ":"b",nù:"c",nş:"m","n‘":9,"o'c":8,obú:"a",ocm:"j",ocui:"j",ocuk:"m",ocz:"l",odob:"l",odpo:"l",odzi:"l",oede:"d",oeg:"d",oek:"d",oesn:8,oew:"d",ofd:"d",oike:"g",oitt:"g",oiu:"j",oix:7,ojc:"l",ojeg:"l",olur:"m",omú:"a",onnt:9,ooit:"d",opd:"d",opg:"d",oruz:"m",osaa:"g",ossz:"i",otde:"j","ou'":8,ough:8,oujo:7,ould:8,ourq:7,ourr:7,ouw:"d",oué:7,"ov'":"c",ovre:"c",ovv:"c","ow'":8,owd:8,"owi ":"l",oyf:8,oyn:"m",oyé:7,ozw:"l",oã:"b",oå:"f",oça:"b",oço:"b","oè ":"c",oël:7,oír:"a",oî:7,oó:"b",où:7,oû:7,"o₂":9,palj:"g",panh:"b",paur:"c",peak:8,pegn:"c",peop:8,peó:"a","pf ":9,pfl:9,pge:"d",piè:7,pmak:"m",pmay:"m","po'":"c",poat:"j",pouv:7,powi:"l",prek:"d",prz:"l",prè:7,pued:"a",puhu:"g",puoi:"c",pués:"a",pyta:"l",pà:"c",pâi:"j",pã:"b",pè:7,pée:7,péu:"b",pôd:"b",pş:"m","q-":"i",qq:"c","qu'":7,qur:8,"quí ":"a","r-o ":"j",raag:"d",rawd:"l","re's":8,"ren'":8,reí:"a",rför:"f",rgd:"d",rijk:"d","rió ":"a",rjoi:"g",rkj:"h",rlf:8,rly:8,rmí:"a",rodz:"l",roun:8,"row ":8,rquo:7,rrow:8,rske:"h",rskj:"h",rsoa:"j",rsq:7,rsök:"f",ruik:"d",ruke:"h",rvä:"f",rykk:"h",rzt:9,rzy:"l","r­":9,rà:"c","rá-":"b",râd:"j",râs:"j",rã:"b",räff:"f",räg:9,räu:9,råg:"f",rån:"f","rè ":"c",rèr:7,"rí ":"a",rías:"a",rív:"b",rôl:7,rù:"c",rû:7,rō:9,"s'es":7,"s'il":7,"s's":8,"s'è":"c","saa ":"g",saan:"g",says:8,saí:"b",saú:"b",sciu:"c",scuc:"a",segí:"i",sehr:9,selb:9,setz:9,"seu ":"b",seul:7,"she ":8,shed:8,shl:8,shr:8,sicu:"c",siin:"g",siit:"g",siy:"m","siz ":"m",siä:"g",siè:7,sión:"a",sjuk:"f",sjö:"f",skje:"h",sks:8,"sn'":8,snil:"h",snö:"f",soas:"b",sotr:"a",spué:"a",ssoa:"b",ssza:"i",ssze:"i",suno:"c",suoi:"c",suur:"g",svå:"f",syy:"g",syö:"g",szab:"i",szik:"i",szy:"l",szá:"i",szé:"i",szí:"i",szül:"i","s­":9,sà:"c",sári:"b","sä ":"g",såd:"f",såg:"f",sè:7,sée:7,ség:"i",sê:"b","sí ":"a",sív:"b",sólo:"a",sô:"b",söy:"m",sù:"c",sû:7,süre:"m","t'v":8,"t'è":"c","t-ce":7,"t-il":7,"t-o ":"j","taa ":"g",tasj:"h",tci:"j",tdea:"j",teir:"b",temt:"h",tení:"a",tept:"j","teu ":"b",tfen:"m",thd:8,they:8,thre:8,tidl:"h",tilb:"h",tinh:"b",tiy:"m",tiè:7,tjen:"h",tly:8,tmek:"m",tmey:"m",tné:"i",toar:"j","tog ":"f",touj:7,tq:9,"tr-":"j",trl:"k",trz:"l",träd:"f",trè:7,ttaa:"g",ttè:"c",tuom:"g",tuvo:"a",tué:7,tvä:"f",två:"f","ty-":8,tylk:"l",tyy:"g","tze ":9,tzl:9,"tzt ":9,tzte:9,tzu:9,tà:"c","tá-":"b","tál ":"i",táx:"b",tâi:"j",tâl:"j",tâmp:"j",târ:"j","tât ":"j",tã:"b","tä ":"g",täi:"g",tåg:"f",tç:"m","tè ":"c",tée:7,ték:"i","tél ":"i",têm:"b",tên:"b","tí ":"a",tío:"a","tól ":"i",tóq:"b",tù:"c","tü ":"m","tün ":"m",tünk:"i",tō:9,"t‘":9,"u'a":7,"u'e":7,"u'i":7,"u'l":8,"u'o":7,"u'r":8,"u'u":7,"u'v":8,"u-i":"j","u-mi":"j",ualc:"c",uap:"a",uase:"b",ucru:"j",ucz:"l",udc:"c",udom:"i",udzi:"l",uede:"a",uego:"a",ueva:"a",uevo:"a",ufen:9,ufg:9,ufz:9,ught:8,ugü:"m",uii:"c",uink:"g",uiu:"b",uién:"a",uió:"a",ujb:"j",ujer:"a",ukaa:"g",umg:9,umne:"j","unn ":"h",unns:"h",unuz:"m",uoc:"c",uog:"c","urd'":7,ureu:7,urü:9,used:8,usst:9,uude:"g",uul:"g","uur ":"d",uuri:"g",uuta:"g",uutt:"g",uvez:7,"uvo ":"a",uvé:7,"uw ":"d",uwd:"d",uws:"d",uwt:"d","ux-":7,uyd:"m",uyor:"m",uyu:"m",uyó:"a",uán:"a",uã:"b",uä:9,uè:7,uée:7,"uém ":"b",uên:"b",uó:"a",uşu:"m","v'e":"c","v'è":"c","v-a":"j","vaa ":"g",vagy:"i",vaik:"g",való:"i",varf:"f","vec ":7,veie:"h",very:8,vesz:"i",veva:"c","vez-":7,vgj:"h",vij:"d",vió:"a","vn ":"h",vnet:"h",voas:"j",vogl:"c",voln:"i",voor:"d",votr:7,"vou ":"b",voul:7,vreb:"c",vreo:"j",vroe:"d",vrou:"d",vuel:"a",vuoi:"c",vuol:"c",vuto:"c",vver:"c",vvo:"c",vz:"m",vâr:"j",vã:"b","vä ":"g",väg:"f",väh:"g",väld:"f",vänd:"f","vät ":"g","vå ":"f",våk:"h",vån:"f",vè:7,vée:7,"vía ":"a",vî:7,"vô ":"b",vú:"i",vş:"m","w's":8,waar:"d",wahr:9,wasn:8,wav:8,ways:8,wcz:"l","we'":8,wea:8,weer:"d",weh:9,wf:8,whe:8,why:8,wia:"l",widz:"l",wiec:"l",wiek:"l",wiem:"l","wil ":"d","wir ":9,wird:9,wirk:9,with:8,"wl ":8,wly:8,woh:9,woi:"l",woj:"l","won'":8,woon:"d",woor:"d",woul:8,wró:"l",wsz:"l",wurd:9,wv:"d",www:"c",wyc:"l",wye:8,wyg:"l",wyj:"l",wyk:"l",wym:"l",wyp:"l",wys:"l",wz:"l",wá:"a",wä:9,wó:"l",wö:9,wü:9,xad:"b",xb:"i","xe-":"b",xed:8,xei:"b",xg:9,xk:9,xm:9,xou:"b",xr:"i",xs:9,xz:9,xã:"b",xíc:"b",xō:"a","y'l":8,"y'n":"m","y'r":8,"y'v":8,"y'y":"m",yaca:"m",yapt:"m",yaş:"m",yby:"l",yci:"l",ycka:"f",ycke:"f",yckl:"f",ycz:"l","ydi ":"m",yea:8,yece:"m",yeu:7,yfr:8,ygd:"h",yhd:"g",yht:"g","yim ":"m",yiy:"m",ykd:"h",ymr:"h",ynyt:"g",yord:"m",yoru:"m",your:8,yrit:"g",ythi:8,ytä:"g",yvin:"g",ywh:8,yâ:"m",yä:"g",yí:"i",yō:9,"z'a":"c","z'o":"c","z-v":7,zaws:"l",zco:"a",zcz:"l",zego:"l",ziec:"l",ziej:"l","zij ":"d",zijn:"d",zinh:"b",ziy:"m","zla ":"m",zoe:"d",zond:"d",zost:"l",zott:"i",zq:"a",zro:"l",ztá:"i",zuu:"d",zwei:9,zyb:"l",zyc:"l",zyj:"l",zyma:"l",zys:"l",zyt:"l",zyw:"l","zz'":"c","zzo ":"c",zzá:"i",zám:"i",zâm:"j",zã:"b",zä:9,zê:"b",zô:"b",zúc:"a","| ":6," =":9," i":9," p":7," u":9," w":"l"," z":"l",ª:"b","­b":9,"­d":9,"­s":9,"²'":"m","· ":"e",ºc:"a","½ ":9,ß:9,"à-":7,àq:"b",às:"b","à ":7,"á'":"i","á-l":"b",áa:"i",ább:"i","ád ":"i","ág ":"i",água:"b",áis:"a",ák:"i",áln:"i",álta:"i","ám ":"i",ána:"i",ány:"i",áo:"i","ár ":"i","ára ":"i",ário:"b",áro:"i",áso:"i","ást ":"i",ásá:"i","át ":"i",áts:"i",átt:"i",ável:"b",áy:"a",áá:"i",áé:"i",áí:"i",áó:"i",áú:"i",áü:"i","â ":"m",âc:7,âg:7,âh:"m","âi ":"j",âin:"j",âk:"m",âln:"j",âmpl:"j",ânca:"j","ând ":"j",ânz:"j",ârs:"j",ârt:"j",ârz:"j","âs ":"j",âu:"j",ây:"m","ã ":"b","ã-":"b",ãe:"b",ãos:"b",ãs:"b",ãz:"b","ä-":"g",äa:"g",äch:9,ädc:9,ädd:"f",äffa:"f",äga:"f",ägg:"f",ägt:9,ähd:"g",ähl:9,ähr:9,ähä:"g",äin:"g",äisi:"g",äit:"g",äiv:"g",äj:"g",äks:"g",äkt:"f",äkä:"g","äl ":"f",äldi:"f","äll ":"f",ällä:"g",älp:"f",älsk:"f","älv ":"f",älä:"g",ämn:"f",ämä:"g",ända:"f",änel:"g","äni ":"g",äny:"g",änä:"g",äq:9,ärn:"f","äsi ":"g",ästa:"f","äta ":"f","ätt ":"f",ätta:"f",ätz:9,ätä:"g",äuf:9,äum:9,ävi:"g",ävä:"g",äx:"f",äy:"g",äz:9,ää:"g",äö:"g",åa:"f",åb:"f",åda:"f",ådi:"h",åel:"h","åg ":"f",åga:"f",åge:"f",ågo:"f",ågr:"f",åh:"f",åka:"f",åkt:"f",åla:"f",åll:"f",åm:"f","ån ":"f",åna:"f",åned:"h",ång:"f",ånn:"h",åpn:"h",åra:"f","åre ":"h",årl:"h",årn:"h",åste:"f",åta:"f","åte ":"h",åtte:"h",åvi:"h",æ:"h","ç ":"m","ç'":"m","ças ":"b",çb:"m",çe:"m",çg:"m",çi:"m",çk:"m",çl:"m",çm:"m",çoc:"m",çok:"m",ços:"b",çou:"b",çr:"m",çs:"m",çt:"m",çy:"m",çá:"b",çã:"b",çç:"m",çó:"b",çö:"m",çú:"b",çü:"m",èb:7,èc:7,èd:7,èg:7,èl:7,èq:7,ès:7,èt:7,èv:7,"è ":"c","é'":"i",écl:7,écou:7,écr:7,ées:7,éfé:7,"ég ":"i","ék ":"i",éke:"i",élet:"i",éln:"i",éno:7,ény:"i",énz:"i","ért ":"i",ész:"i","ét ":"i",étai:7,étud:7,"été ":7,"éu ":"b",éâ:7,éç:7,één:"d",éü:"i","ê ":"b","ê-":"b",êb:"b",êc:7,êl:7,"êm ":"b","ême ":7,ênc:"b",ênd:"b",êni:"b",êp:7,ês:"b",êt:7,êu:"b",êv:7,êx:"b",ëe:"d",ëi:"d",ën:"d",ër:"d",ëz:"d",ì:"c","í-":"b",ían:"a",ík:"i",íng:"b","ío ":"a",íos:"a",íss:"b",íç:"b","î ":"m",îc:7,îi:"j","îl ":"j",îmb:"j",îmi:"j",împ:"j","în ":"j",înc:"j",înd:"j",înf:"j",îng:"j",înn:"j",înr:"j",îns:"j",înt:"j",înv:"j",ît:7,îş:"j",ïf:7,ïnt:"d",ñ:"a",ò:"c","ó-":"i",óa:"i",ócu:"b",óe:"i",óh:"i","ój ":"l","ólo ":"a","ómo ":"a",ónd:"a",óo:"i",ópr:"b",óry:"l",óu:"i",ów:"l",óá:"i",óé:"i",óí:"i",ôni:"b",ôp:7,ôq:"b",ôr:"b",ôs:"b",ôt:7,ôv:"b",õ:"b",öbb:"i",öch:9,öda:"f",öe:9,ögon:"f",öhn:9,öi:"g",öjd:"f",öjl:"f",önce:"m",önnt:9,öo:"g",öra:"f",örja:"f",örsö:"f",örté:"i",össz:"i",ötü:"m",öw:9,öyle:"m",öä:"g",öç:"m",öö:"g",öş:"m",ø:"h","ú-":"i",úe:"a",úgy:"i",úi:"i","új ":"i",úk:"i",úo:"a",úvi:"b",úy:"a","û ":7,ûl:7,ûr:7,ût:7,"ü'":"m",üch:9,ück:9,üen:"a",ühl:9,ühr:9,ünf:9,"ünk ":"i",ünm:"m",ünü:"m",ütf:"m",ütz:9,ütü:"m",üy:"m","üz ":"m",üç:"m",üé:"a",üí:"a",üş:"m",ā:8,ă:"j",ą:"l",ć:"l",ę:"l",ğ:"m","ī ":9,ı:"m",ł:"l",ń:"l","ō ":9,ōb:9,ōc:"a",ōg:9,ōk:9,ōs:9,ōt:9,ő:"i",œ:7,ś:"l","ş'":"m",şam:"m",şan:"m",şar:"m",şb:"m",şek:"m",şey:"m",şf:"m",şg:"m",şh:"m","şi-":"j",şim:"m",şk:"m",şl:"m",şm:"m",şr:"m",şs:"m",ştu:"m",şv:"m",şy:"m",şç:"m",şö:"m",şü:"m",şş:"m",š:"g",ţ:"j",ū:9,ű:"i",ź:"l",ż:"l",ș:"j",ț:"j","́":"k","̇":"m","΄":"e",ΐ:"e",ά:"e",έ:"e",ή:"e",ί:"e",α:"e",β:"e",γ:"e",δ:"e",ε:"e",ζ:"e",η:"e",θ:"e",ι:"e",κ:"e",λ:"e",μ:"e",ν:"e",ξ:"e",ο:"e",π:"e",ρ:"e",ς:"e",σ:"e",τ:"e",υ:"e",φ:"e",χ:"e",ψ:"e",ω:"e",ϊ:"e",ό:"e",ύ:"e",ώ:"e",а:"k",б:"k",в:"k",г:"k",д:"k",е:"k",ж:"k",з:"k",и:"k",й:"k",к:"k",л:"k",м:"k",н:"k",о:"k",п:"k",р:"k",с:"k",т:"k",у:"k",ф:"k",х:"k",ц:"k",ч:"k",ш:"k",щ:"k",ъ:"k",ы:"k",ь:"k",э:"k",ю:"k",я:"k",ё:"k",ѣ:"k","ְ":"n","ֱ":"n","ֲ":"n","ִ":"n","ֵ":"n","ֶ":"n","ַ":"n","ָ":"n","ֹ":"n","ֻ":"n","ּ":"n","ֽ":"n","־":"n","ׁ":"n","ׂ":"n",א:"n",ב:"n",ג:"n",ד:"n",ה:"n",ו:"n",ז:"n",ח:"n",ט:"n",י:"n",ך:"n",כ:"n",ל:"n",ם:"n",מ:"n",ן:"n",נ:"n",ס:"n",ע:"n",ף:"n",פ:"n",ץ:"n",צ:"n",ק:"n",ר:"n",ש:"n",ת:"n","׳":"n","״":"n","،":"o","؛":"o","؟":"o",ء:"o",آ:"o",أ:"o",ؤ:"o",إ:"o",ئ:"o",ا:"o",ب:"o",ة:"o",ت:"o",ث:"o",ج:"o",ح:"o",خ:"o",د:"o",ذ:"o",ر:"o",ز:"o",س:"o",ش:"o",ص:"o",ض:"o",ط:"o",ظ:"o",ع:"o",غ:"o",ـ:"o",ف:"o",ق:"o",ك:"o",ل:"o",م:"o",ن:"o",ه:"o",و:"o",ى:"o",ي:"o","ً":"o","ٌ":"o","ٍ":"o","َ":"o","ُ":"o","ِ":"o","ّ":"o","ْ":"o","٠":"o","١":"o","٩":"o",ٱ:"o",ک:"o",ی:"o","ँ":6,"ं":6,"ः ":6,अ:6,आ:6,इ:6,ई:6,उ:6,ऊ:6,ए:6,ऐ:6,ऑ:6,ओ:6,औ:6,क:6,ख:6,ग:6,घ:6,च:6,छ:6,ज:6,झ:6,ट:6,ठ:6,ड:6,ढ:6,ण:6,त:6,थ:6,द:6,ध:6,न:6,प:6,फ:6,ब:6,भ:6,म:6,य:6,र:6,ल:6,व:6,श:6,ष:6,स:6,ह:6,"़":6,"ा":6,"ि":6,"ी":6,"ु":6,"ू":6,"ृ":6,"ॅ":6,"े":6,"ै":6,"ॉ":6,"ो":6,"ौ":6,"्":6,"०":6,"१":6,"२ ":6,"५ ":6,"९":6,"ঁ":5,"ং":5,অ:5,আ:5,ই:5,উ:5,এ:5,ঐ:5,ও:5,ক:5,খ:5,গ:5,ঘ:5,ঙ:5,চ:5,ছ:5,জ:5,ঝ:5,ঞ:5,ট:5,ঠ:5,ড:5,ঢ:5,ণ:5,ত:5,থ:5,দ:5,ধ:5,ন:5,প:5,ফ:5,ব:5,ভ:5,ম:5,য:5,র:5,ল:5,শ:5,ষ:5,স:5,হ:5,"়":5,"া":5,"ি":5,"ী":5,"ু":5,"ূ":5,"ৃ":5,"ে":5,"ৈ":5,"ো":5,"ৌ":5,"্":5,ৎ:5,"০":5,"১":5,"২":5,"৩ ":5,"৪ ":5,"৫":5,"৬ ":5,"৭":5,"৮ ":5,"৯":5,ก:4,ข:4,ค:4,ง:4,จ:4,ฉ:4,ช:4,ซ:4,ญ:4,ฎ:4,ฏ:4,ฐ:4,ณ:4,ด:4,ต:4,ถ:4,ท:4,ธ:4,น:4,บ:4,ป:4,ผ:4,ฝ:4,พ:4,ฟ:4,ภ:4,ม:4,ย:4,ร:4,ฤ:4,ล:4,ว:4,ศ:4,ษ:4,ส:4,ห:4,ฬ:4,อ:4,ฮ:4,ะ:4,"ั":4,า:4,ำ:4,"ิ":4,"ี":4,"ึ":4,"ื":4,"ุ":4,"ู":4,เ:4,แ:4,โ:4,ใ:4,ไ:4,ๆ:4,"็":4,"่":4,"้":4,"๊":4,"๋":4,"์":4,ὰ:"e",ὸ:"e","​e":"d","​v":"d","​y":"m","‌":5,"‏":"o","― ":"k","‘ ":9,"‘s":"d","‚":9,"‟ ":9,"‬":"o","‮":"o"," °":9,"№ ":"k","−":9,あ:1,い:1,う:1,え:1,お:1,か:1,が:1,き:1,く:1,け:1,こ:1,さ:1,し:1,じ:1,す:1,せ:1,そ:1,た:1,だ:1,ち:1,っ:1,つ:1,て:1,で:1,と:1,ど:1,な:1,に:1,ね:1,の:1,は:1,ば:1,へ行:1,べ:1,ま:1,み:1,め:1,も:1,ゃ:1,や:1,よ:1,ら:1,り:1,る:1,れ:1,ろ:1,わ:1,を:1,ん:1,ア:1,イ:1,オオカミ:1,カナダ:1,カ合衆国:1,キャプテ:1,ク:1,シャ:1,ジャ:1,ジョ:1,ス:1,タバコ:1,チョコ:1,ッ:1,ティ:1,テレ:1,ディズニ:1,ト:1,ニュ:1,プレゼ:1,プロジェ:1,ミュニケ:1,ム:1,ラ:1,リ:1,ル:1,レビ:1,ン:1,"・・・":1,ー:1,一下:2,一度:1,一日中:1,"一本書 ":2,一生懸:1,一番:1,一緒:1,一起:2,一週間:1,上げ:1,上手:1,"下雨 ":2,不会:2,不可能的:2,"不在家 ":2,不思議:1,不想:2,不是:2,不注意:1,不知:2,不能:2,不要:2,世界一周:1,世界上:2,世界中:1,世界大戦:1,世界平和:1,"东西 ":2,个:2,中華料理:1,为:2,丽:2,么:2,之:2,也:2,书:2,"了 ":2,了一:2,了他:2,了我:2,事務所:1,二次世界:1,交通渋滞:1,人々:1,人間:1,什:2,今天:2,"今日 ":1,仕事:1,"他 ":2,他是:2,他的:2,们:2,"任何人 ":2,会社:1,但:2,住在:2,"作 ":2,你:2,來:2,"個問題 ":2,"個小時 ":2,們:2,"候 ":2,做:2,儿:2,冷蔵庫:1,出発:1,到了:2,勉強:1,動車事故:1,医者:1,"去 ":2,"去学校 ":2,友達:1,发:2,可以:2,可俗話又:2,"可能的 ":2,名前:1,"名字 ":2,吗:2,吧:2,告诉:2,"呢 ":2,"咖啡 ":2,哪:2,"啊 ":2,嗎:2,"回家 ":2,図書館:1,在波士頓:2,在波士顿:2,"地方 ":2,"多少錢 ":2,"多少钱 ":2,大丈夫:1,大統領:1,天早上:2,天然資源:1,她:2,"好 ":2,好的:2,如果:2,姆:2,委員会:1,子供:1,"学习 ":2,学校へ:1,学生時代:1,孩:2,學:2,它:2,宇宙飛行:1,宙飛行士:1,家族:1,对:2,對:2,就是:2,工作:2,"巧克力 ":2,已:2,庁所在地:1,应该:2,开:2,弁護士:1,彼女:1,很:2,怎:2,息子:1,您:2,想要:2,"意思 ":2,"感兴趣 ":2,懸命勉:1,"我 ":2,我々:1,我一:2,我不:2,我在:2,我希望:2,我想:2,我是:2,我有:2,我的:2,我第一次:2,我要:2,我觉得:2,我需要:2,"房子 ":2,所有的:2,手伝:1,手紙:1,"打網球 ":2,打電話給:2,携帯電話:1,日本語:1,早寝早起:1,时:2,明天:2,明日:1,映画:1,昨天:2,昨日:1,是一:2,是不:2,"是多少 ":2,是我:2,時候:2,時間以上:1,晚:2,曜日:1,會:2,有一:2,有人:2,朋:2,本当:1,"来的 ":2,"東西 ":2,样:2,欢:2,歡:2,殺人事件:1,毎日:1,每:2,民主主義:1,気:1,汤:2,沒:2,没有:2,"波士頓 ":2,"波士顿 ":2,海外旅行:1,"游泳 ":2,澳大利亚:2,现:2,生懸命:1,"生活 ":2,的东西:2,的事:2,的人:2,的名字:2,"的問題 ":2,"的国家 ":2,的地方:2,"的城市 ":2,"的女人 ":2,"的想法 ":2,的房子:2,"的房間 ":2,"的故事 ":2,"的照片 ":2,"的話 ":2,"看电视 ":2,看起来:2,"看電視 ":2,県庁所在:1,真的:2,知道:2,私達:1,科学技術:1,第二次世:1,約束:1,经:2,给:2,而:2,自分:1,自動車:1,自己的:2,自己紹介:1,自転車:1,"色的 ":2,行方不明:1,裡:2,西班牙:2,见:2,言葉:1,計画:1,試験:1,誕生日:1,說:2,読む価値:1,话:2,语:2,说:2,请:2,跟:2,车:2,过:2,还:2,这:2,這個:2,運転:1,部屋:1,郵便局:1,"里 ":2,"重要 ":2,重要的:2,間違:1,"问题 ":2,间:2,電話番号:1,音楽:1,飛行機:1,高校時代:1,高速道路:1,麼:2,點:2,가:3,거:3,"건 ":3,"걸 ":3,것:3,게:3,"계속 ":3,고:3,"과 ":3,그:3,기:3,"까 ":3,나:3,난:3,내:3,너:3,"네 ":3,는:3,니:3,다:3,"더 ":3,"데 ":3,도:3,"든 ":3,들:3,라:3,로:3,를:3,리:3,마:3,만:3,말:3,"면 ":3,무:3,보:3,사:3,생각:3,서:3,선생님:3,세:3,수:3,스:3,시:3,신:3,아:3,안:3,않:3,야:3,어:3,없:3,었:3,에:3,여:3,오늘:3,"와 ":3,"왜 ":3,요:3,우:3,으:3,은:3,을:3,의:3,이:3,인:3,일:3,있:3,자:3,"절대 ":3,제:3,"좀 ":3,좋:3,주:3,지:3,"처럼 ":3,컴퓨터:3,"테 ":3,텔레비전:3,톰:3,프랑:3,하:3,한:3,"할 ":3,"함께 ":3,"항상 ":3,해:3,했:3,"히 ":3,𝑥:9,"- ":9,";可俗話":2,"�":9}},O=/([,,、。!¿?!?":;()「」{}„“«»”"“<>⋯《》*]|[.[\]\\])+/,S=/[ ]+/;function J(e){return e.split(S)}function j(e,n,t=!0){let o=[],a=t?" ".repeat(n-1)+e+" ".repeat(n-1):e;for(let e=0;e1)&&t.push(a[e+o]);let r=t.join("");r.trim().length>0&&r.length===n&&o.push(r)}return o}function z(e,n,t,o){for(let a of y){let i=j(e,a);for(let e of i){if(!t.has(e))continue;let i=k(n.uniques[e]);if(!(o.only.length>0)||o.only.includes(i))return o.verbose&&console.log(`[Pass 1] detectUniqueGrams ${a}-grams - match '${e}' to ${i}`),i}}return""}function K(e,n,t){let o=new Map,a=y.map((n=>j(e,n))).flat();t.verbose&&console.log("[Pass 2] DetectPotentialGrams",e,a);let i=new Set([...G.values()].filter((e=>!(t.only.length>0)||t.only.includes(e)||t.only.includes(k(e)))));i.forEach((e=>o.set(e,0)));for(let e of a){let a=D(e),r=n.multiples[a];if(!r)continue;let s=new Set(Object.keys(r)),l=[];for(let e of i)s.has(e)&&(o.set(e,(o.get(e)||0)+r[e]*a.length/4),l.push(`${e} = ${r[e]/1024*100}%`));t.verbose&&l.length>0&&console.log(`Gram '${a}'`,l)}let r=[...o.entries()];r.sort(((e,n)=>n[1]-e[1]));let s=Math.max(...r.map((e=>e[1])))||1,l=r.slice(0,8).map((e=>({lang:k(e[0]),accuracy:1-M((s-e[1])/s),score:M(e[1])})));return t.verbose&&console.log("Result",e,l),l}var E=H,P={uniques:Object.fromEntries(Object.entries(E.uniques).map((e=>[e[0],V[parseInt(e[1].toString(),36)]]))),multiples:Object.fromEntries(Object.entries(E.multiples).map((e=>{let n=Object.fromEntries(e[1].match(/(.{1,3})/g)?.map((e=>{let n=e.slice(0,1),t=e.slice(1);return[V[parseInt(n,36)],parseInt(t,36)]}))||[]);return[e[0],n]})))},x=new Set(Object.keys(H.uniques));function N(e,n){let t=function(e,n){let t=T(n);return function(e){return"string"==typeof e||e instanceof String}(e)?function(e,n,t,o){let a=function(e){return e.split(O)}(e);a=a.map((e=>function(e){return e.toLowerCase().replace(f,"'").replace(h," ").replace(I,(e=>String.fromCharCode(e.charCodeAt(0)-65248))).replace(A,"").replace(b," ").trim()}(e))).filter((e=>!!e)),a.sort(((e,n)=>n.length-e.length)),a=a.slice(0,7),n.verbose&&console.log("Analize chunks",a);let i=0,r={};for(let e of a){let a=z(e,t,o,n);if(a){r[a]=(r[a]||0)+1*e.length,i+=e.length;continue}let s=J(e);for(let e of s)K(e,t,n).forEach((e=>{r[e.lang]=(r[e.lang]||0)+e.accuracy})),i+=e.length}let s=Object.entries(r).filter((e=>e[1]>0));s.sort(((e,n)=>n[1]-e[1]));let l=s.map((e=>({lang:e[0],accuracy:e[1]/i})));return n.verbose&&console.log("Merge Results",l),l}(e,t,P,x):[]}(e,n);return t.length>0?t[0].lang:""}function R(e,n,t,o,a){if(!window.location.hostname.includes("m.youtube.com")){const n=e.getAudioTrack(),t=n?.getLanguageInfo();if("und"!==t?.id)return t.id.split(".")[0]}const i=n?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}return N([t,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").slice(0,250))}function q(){const e=document.querySelector("#movie_player"),n=e.getVideoData(),t=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=n,{shortDescription:s}=t?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:R(e,t,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}var U=t("./src/yandexRequests.js"),Z=t("./src/config/constants.js"),Q=t("./src/utils/debug.js");let W=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function Y(e){document.querySelector(".translationBtn").style.color=e}function X(e="none"){document.querySelector(".translationBtn").dataset.state=e}function _(e="none"){let n;switch(e){case"error":n="#7A7A7D";break;case"success":n="#A36EFF";break;default:n="#FFFFFF"}document.querySelector(".translateIcon").style.fill=n}function $(e="none",n){switch(e){case"error":_(e),Y("#7A7A7D"),X(e);break;case"success":_(e),Y("#A36EFF"),X(e);break;default:_("none"),Y("#FFFFFF"),X("none")}document.querySelector(".translationBtn").innerText=n}function ee(e,n,t){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(n),i.htmlFor=e,i.innerHTML=t,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function ne(e,n,t){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=n,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=t,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function te(e,n){const t=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of n){const n=document.createElement("option");n.innerText=e.label,n.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&n.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(n.disabled=e.disabled),o.appendChild(n)}return t.classList.add("translationMenuContainer"),t.appendChild(o),t}function oe(e){return new Promise((n=>{const t=document.querySelector(e);if(t)return n(t);const o=new MutationObserver((()=>{const t=document.querySelector(e);t&&(n(t),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}W in Z.Iz||(W="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(n,t){return void 0!==e[t]?e[t]:n}))});const ae=e=>new Promise((n=>setTimeout(n,e))),ie=e=>{const n=new URL(window.location.href);switch(e){case"youtube":return n.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||n.searchParams.get("v");case"vk":return n.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?n.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):n.searchParams.get("z")?n.searchParams.get("z").split("/")[0]:!(!n.searchParams.get("oid")||!n.searchParams.get("id"))&&`video-${Math.abs(n.searchParams.get("oid"))}_${n.searchParams.get("id")}`;case"9gag":case"gag":return n.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||n.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${n.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${n.searchParams.get("clip")}`}return n.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?n.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:n.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return n.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return n.pathname.match(/[^/]+\/[^/]+$/)?.[0]||n.pathname.match(/[^/]+$/)?.[0];case"xvideos":return n.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return n.searchParams.get("viewkey")||n.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return n.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return n.pathname;case"rutube":return n.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"bilibili.com":const e=n.searchParams.get("bvid");if(e)return e;{let e=n.pathname.match(/video\/([^/]+)/)?.[1];return e&&n.search&&null!==n.searchParams.get("p")&&(e+=`/?p=${n.searchParams.get("p")}`),e}case"mail.ru":if(n.pathname.startsWith("/v/")||n.pathname.startsWith("/mail/"))return n.pathname;default:return!1}};var re=t("./src/config/config.js");const se=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],le=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],de=2,ue={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},ce={audioProxy:0};function me(e){return indexedDB.open(e,de)}async function ge(){return new Promise(((e,n)=>{const t=me("VOT");t.onerror=()=>{console.error(`${Z.Iz[W].VOTFailedInitDB}: ${t.error.message}`),n(!1)},t.onupgradeneeded=o=>{const a=t.result;if(a.onerror=()=>{const e=Z.Iz[W].VOTFailedInitDB;alert(e),console.error(e,t.error),n(!1)},o.oldVersion<1){const t=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(ue).filter((e=>"key"!==e)))t.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),t.transaction.oncomplete=t=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(ue);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),n(!1)}}}o.oldVersion<2&&function(t,o,a,i={}){const r=t.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=t=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),n(!1)},s.onsuccess=()=>{const t=s.result||Object.assign(ue,i);for(const e in a)t[e]=a[e];const o=r.put(t);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),n(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(t.transaction,a,ce)},t.onsuccess=()=>{const o=t.result;o.onversionchange=()=>{o.close();const e=Z.Iz[W].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),n(!1)},e(!0)},t.onblocked=()=>{const e=t.result,o=Z.Iz[W].VOTDisabledForDBUpdating;console.error(o,e),alert(o),n(!1)}}))}async function pe({autoTranslate:e,defaultVolume:n,showVideoSlider:t,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof n||"number"==typeof t||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=me("VOT");d.onerror=()=>{const e=Z.Iz[W].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await ge(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),m=c.get("settings");m.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},m.onsuccess=()=>{const d=m.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof n&&(d.defaultVolume=n),"number"==typeof t&&(d.showVideoSlider=t),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,n=Z.Iz[W].VOTDisabledForDBUpdating;console.error(n,e),alert(n),l(!1)}}}))}function he(){indexedDB.deleteDatabase("VOT")}function Ae(e,n,t,o){let a;return n>o?(a=t+(n-o),a=a>100?100:Math.max(a,0),e.volume=a/100):n100?100:Math.max(a,0),e.volume=a/100),a}var Ie=t("./src/config/config-cloudflare.js");const be={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},fe=".html5-video-container",Be=".video-ref",De="main > div > section > div > div > div",Fe=".shaka-video-container",ve=".videoplayer_media",ye='div[data-testid="videoComponent"] > div:nth-child(1) > div',Le=".player",Me=".video-post",Te=".bpx-player-video-wrap",Ce="#b-video-wrapper",Ge=[...se,...le];(async function(){Q.Z.log("Loading extension..."),Q.Z.log(`Selected menu language: ${W}`);const e=(await Promise.resolve().then(t.bind(t,"./src/rvt-cloudflare.js"))).default;let n;Q.Z.log("Inited requestVideoTranslation..."),Q.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(n),s(1),n=setTimeout((()=>{s(0)}),2e3)}function d(e,n,t){clearTimeout(n),s(t),e.stopPropagation()}async function u(t,u,c){let m,g,p,h,A,I,b,f,B,D,F,v;Q.Z.log("[translateProccessor] execute on element: ",t);let y,L=!0;Q.Z.log("videoContainer",t),m="vimeo"===u?t.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):t.querySelector("video"),Q.Z.log("video",m);let M=function(){const e={};if(e.duration=m?.duration||0,e.videoId=ie(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")){let n=q();n=w(n,n.detectedLanguage),e.detectedLanguage=n.detectedLanguage,e.responseLanguage=n.responseLanguage}else window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh");return e}();console.log("VOT Video Data: ",M);const T="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):t;!function(e){if(!e||e.querySelector(".translationBlock"))return;const n=document.createElement("div");n.classList.add("translationBlock"),n.innerHTML=`\n \n \n \n \n \n \n ${Z.Iz[W].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(n),Q.Z.log("VOT: Added translation button to ",e)}(T),function(e){if(e.querySelector(".translationMenuContent"))return;const n=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${Z.Iz[W].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(n),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const n=document.querySelector(".translationMenuContent");n.style.display=i?"none":"block",n.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),he(),location.reload()})),Q.Z.log("VOT: Added translation menu to ",e)}(T);try{y=await ge()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const C=document.querySelector(".translationMenuOptions");if(C&&!C.querySelector("#VOTTranslateFromLang")){const e=[{label:Z.Iz[W].videoLanguage,value:"default",disabled:!0},...Object.entries(Z.tW).map((([e,n])=>({label:Z.Iz[W][n],value:e,selected:M.detectedLanguage===e})))],n=[{label:Z.Iz[W].translationLanguage,value:"default",disabled:!0},...Object.entries(Z.tW).map((([e,n])=>({label:Z.Iz[W][n],value:e,selected:M.responseLanguage===e})))],t=te("VOTTranslateFromLang",e),o=te("VOTTranslateToLang",n).firstElementChild;t.id="VOTSelectLanguages",t.innerHTML+='\n \n \n \n ',t.appendChild(o),C.appendChild(t),C.querySelector("#VOTTranslateFromLang").addEventListener("change",(e=>{Q.Z.log("[onchange] select from language",e.target.value),M=w(M,e.target.value)})),C.querySelector("#VOTTranslateToLang").addEventListener("change",(e=>{Q.Z.log("[onchange] select to language",e.target.value),M=V(M,e.target.value)}))}if(y){const e=await async function(){return new Promise(((e,n)=>{const t=me("VOT");t.onerror=()=>{const e=Z.Iz[W].VOTFailedReadFromDB;alert(e),console.error(e,t.error.message),n(!1)},t.onupgradeneeded=async()=>{t.result.close(),await ge(),e(!0)},t.onsuccess=()=>{const o=t.result;o.onversionchange=()=>{o.close();const e=Z.Iz[W].VOTDBNeedUpdate;alert(e),console.error(e),n(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(Z.Iz[W].VOTFailedReadFromDB,e.error),console.error(e),n(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),he(),n(!1));const t=a.result;e(t)}},t.onblocked=()=>{const e=t.result,o=Z.Iz[W].VOTDisabledForDBUpdating;console.error(o,e),alert(o),n(!1)}}))}();if(e){if(I=e.autoTranslate,b=e.defaultVolume,f=e.showVideoSlider,B=e.autoSetVolumeYandexStyle,D=e.dontTranslateYourLang,v=e.audioProxy,F=e.syncVolume,Q.Z.log("[db] data from db: ",e),void 0!==I&&C&&!C.querySelector("#VOTAutoTranslate")){const e=ee("VOTAutoTranslate",I,Z.Iz[W].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${Z.Iz[W].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const n=Number(e.target.checked);await pe({autoTranslate:n}),I=n,Q.Z.log("autoTranslate value changed. New value: ",I)},C.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==D&&C&&!C.querySelector("#VOTDontTranslateYourLang")){const e=ee("VOTDontTranslateYourLang",D,Z.Iz[W].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const n=Number(e.target.checked);await pe({dontTranslateYourLang:n}),D=n,Q.Z.log("dontTranslateYourLang value changed. New value: ",D)},C.appendChild(e)}if(void 0!==B&&C&&!C.querySelector("#VOTAutoSetVolume")){const e=ee("VOTAutoSetVolume",B,Z.Iz[W].VOTAutoSetVolume+(100*re.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const n=Number(e.target.checked);await pe({autoSetVolumeYandexStyle:n}),B=n,Q.Z.log("autoSetVolumeYandexStyle value changed. New value: ",B)},C.appendChild(e)}if(void 0!==f&&C&&!C.querySelector("#VOTShowVideoSlider")){const e=ee("VOTShowVideoSlider",f,Z.Iz[W].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const n=Number(e.target.checked);await pe({showVideoSlider:n}),f=n,Q.Z.log("showVideoSlider value changed. New value: ",f),1===f&&"success"===document.querySelector(".translationBtn").dataset.state?S():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},C.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==F&&C&&!C.querySelector("#VOTSyncVolume")){const e=ee("VOTSyncVolume",F,Z.Iz[W].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const n=Number(e.target.checked);await pe({syncVolume:n}),F=n,Q.Z.log("syncVolume value changed. New value: ",F)},C.appendChild(e)}if(void 0!==v&&C&&!C.querySelector("#VOTAudioProxy")){const e=ee("VOTAudioProxy",v,Z.Iz[W].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const n=Number(e.target.checked);await pe({audioProxy:n}),v=n,Q.Z.log("audioProxy value changed. New value: ",v)},C.appendChild(e)}}}function G(e,n=W){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${n}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=n)}function w(e,n){switch(n){case"en":e.detectedLanguage=n,e.responseLanguage=W;break;case"ru":e.detectedLanguage=n,e.responseLanguage=W,"ru"==W&&(e.responseLanguage="en");break;default:if(!Object.keys(Z.tW).includes(n))return w(e,"en");e.detectedLanguage=n}return G(e.detectedLanguage,e.responseLanguage),e}function V(e,n){if("en"===n)e.responseLanguage=n,e.detectedLanguage="ru";else{if(!Object.keys(Z.tW).includes(n))return V(e,"ru");e.detectedLanguage&&e.responseLanguage===W&&(e.detectedLanguage="en"),e.responseLanguage=n}return G(e.detectedLanguage,e.responseLanguage),e}function k(){o.pause(),m.removeEventListener(".translate",k,!1),o.src="",o.removeAttribute("src"),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",$("none",Z.Iz[W].translateVideo),p&&(m.volume=p)}function H(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),n=document.querySelector("#VOTVideoSlider");if(!n)return;n.value=e;const t=document.querySelector("#VOTVideoVolume");t&&(t.innerText=`${e}%`),1===F&&(h=Number(e))}$("none",Z.Iz[W].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&H()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const O=(e=!1)=>{if(Q.Z.log("lipsync video",m),m)if(o.currentTime=m.currentTime,o.playbackRate=m.playbackRate,e)if("play"!==e)"pause"===e&&(Q.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(Q.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(Q.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(Q.Z.log("lipsync mode is playing"),o.play()),"abort"===e&&(Q.Z.log("lipsync mode is abort"),o.pause());else{Q.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=Z.Iz[W].grantPermissionToAutoPlay;throw $("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Ge.includes(window.location.hostname)?Z.Iz[W].neededAdditionalExtension:Z.Iz[W].audioFormatNotSupported;throw $("error",e),`VOT: ${e}`}}))}else Q.Z.log("lipsync mode is not set")};function S(){if(1!==f||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!B?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*m.volume);h=e;const n=ne("VOTVideoSlider",e,`${Z.Iz[W].VOTVolume}: ${e}%`);n.querySelector("#VOTVideoSlider").oninput=e=>{const{value:t}=e.target;if(m.volume=t/100,n.querySelector("#VOTOriginalVolume").innerText=`${t}%`,1!==F)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=Ae(o,t,i,h);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),A=r,h=t},document.querySelector(".translationMenuOptions").appendChild(n)}const J=e=>{Q.Z.log("Run videoValidator"),function(){if(window.location.hostname.includes("youtube.com")){let e=q();if(e=w(e,e.detectedLanguage),Q.Z.log("VideoValidator videoData: ",M),1===D&&e.detectedLanguage===W)throw L=!1,Z.Iz[W].VOTDisableFromYourLang;if(e.isLive)throw Z.Iz[W].VOTLiveNotSupported;if(e.isPremiere)throw Z.Iz[W].VOTPremiere;if(M.duration>14400)throw Z.Iz[W].VOTVideoIsTooLong}}(),Q.Z.log("Run translateFunc"),K(e,M.detectedLanguage,M.responseLanguage)};function j(e){Q.Z.log(`video ${e.type}`),O(e.type)}function z(){k(),H()}function K(n,a,i){!function(n,t,o,a,i){Q.Z.log(`Translate video (url: ${n}, unknown1: ${t}, requestLang: ${o}, responseLang: ${a})`),r?Q.Z.log("translationPanding return"):(r=!0,e(n,t,o,a,((e,n)=>{if(r=!1,Q.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,Z.Iz[W].requestTranslationFailed);const t=U.G.decodeResponse(n);switch(console.log("VOT Response: ",t),t.status){case 0:i(!1,t.message);break;case 1:i(!!t.url,t.url||Z.Iz[W].audioNotReceived);break;case 2:i(!1,t.remainingTime?function(e){const n=Math.floor(e/60),t=Math.floor(e%60);return n>=60?Z.Iz[W].translationTakeMoreThanHour:n>=10&&n%10?Z.Iz[W].translationTakeApproximatelyMinutes.format(n):1==n||0==n&&t>0?Z.Iz[W].translationTakeAboutMinute:Z.Iz[W].translationTakeApproximatelyMinute.format(n)}(t.remainingTime):Z.Iz[W].translationTakeFewMinutes);break;case 3:i(!1,Z.Iz[W].videoBeingTranslated)}})))}(`${Z.g$[u]}${n}`,Z.ey,a,i,(async(e,r)=>{if(Q.Z.log("[exec callback] translateVideo"),ie(u)!==n)return;if(!e)throw $("error",r),r.includes(Z.Iz[W].translationTake)&&(clearTimeout(g),g=setTimeout((()=>K(n,a,i)),6e4)),r;if(o.src=r,1===v&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),n=`https://${Ie.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${n}`),o.src=n}switch(p=m?.volume,"number"==typeof b&&(o.volume=b/100),"number"==typeof B&&B&&(m.volume=re.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",z);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,z)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===m&&""!==e.target.src&&(z(),L=!0)}))})).observe(t,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}m&&!m.paused&&O("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((n=>e.addEventListener(n,j))))),$("success",Z.Iz[W].disableTranslate),S(),function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof b?b:100;h=e;const n=ne("VOTTranslationSlider",e,`${Z.Iz[W].VOTVolumeTranslation}: ${e}%`);n.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await pe({defaultVolume:Number(e)}),b=Number(e),1===F&&function(e){const n=document.querySelector("#VOTVideoSlider");if(!n)return;const t=Number(n.value),o=Ae(m,e,t,A);n.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),h=o,A=e}(e)},document.querySelector(".translationMenuOptions").appendChild(n)}();const I=document.querySelector("#VOTVideoSlider");I&&(I.value=100*re.IM);const f=document.querySelector("#VOTOriginalVolume");f&&(f.innerText=100*re.IM+"%");const D=document.querySelector(".translationDownload");D.href=r,D.style.display="initial"}))}document.addEventListener("click",(e=>{const n=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!n&&e.target!==n)&&n.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!t&&e.target!==t)&&t.contains(e.target);Q.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const E=(e,n,t)=>{n.forEach((n=>e.addEventListener(n,t)))};"pornhub"===u?window.location.pathname.includes("view_video.php")?E(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&E(document.querySelector("#player"),["mousemove","mouseout"],l):E("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):t,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,n,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,n,a))),document.addEventListener("touchstart",(e=>d(e,n,a))),document.addEventListener("touchmove",(e=>d(e,n,a))),document.addEventListener("touchend",(e=>d(e,n,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(Q.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return Q.Z.log("[click translationBtn] audio.src is not empty"),void k();try{Q.Z.log("[click translationBtn] trying execute translation");const e=ie(u);if(!e)throw Z.Iz[W].VOTNoVideoIDFound;J(e)}catch(e){$("error",String(e).substring(4,e.length)),console.error(e)}})),m.addEventListener("progress",(e=>{if(e.stopPropagation(),!L||1!==I)return;const n=ie(u);if(!n)throw Z.Iz[W].VOTNoVideoIDFound;try{J(n),L=!1}catch(e){$("error",String(e).substring(4,e.length)),L=!1}}))}await async function(){if(Q.Z.log("Runned initWebsite function"),be.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}Q.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(fe);if(e)Q.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void Q.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{Q.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const n=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",n),document.addEventListener("yt-navigate-start",n),window.location.hostname.includes("m.youtube.com")){let e=await oe("#player");e&&(await ae(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async n=>{for(const t of n)"attributes"===t.type&&"src"===t.attributeName&&(e=await oe("#player"),await ae(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const n=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",n),document.addEventListener("yt-navigate-finish",n),document.addEventListener("spfrequest",n),document.addEventListener("yt-navigate-start",n)}}else if(window.location.hostname.includes("twitch.tv")){if(Q.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(Q.Z.log("[initWebsite] Matched Twitch Mobile"),await oe(De)){await ae(200);const e=document.querySelector(De);await u(e,"twitch",null),new MutationObserver((async n=>{for(const t of n)"attributes"===t.type&&"src"===t.attributeName&&t.target===e?.querySelector("video")&&(await ae(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){Q.Z.log("[initWebsite] Matched Twitch Desktop");const e=await oe(Be);e&&(await ae(200),await u(e,"twitch",null))}Q.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return Q.Z.log("[entered] xvideos"),await ae(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return Q.Z.log("[entered] pornhub"),await ae(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(se.includes(window.location.hostname))Q.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(le.includes(window.location.hostname)){Q.Z.log("[entered] piped");const e=await oe(Fe);if(e){let n,t=ie("youtube");await u(e,"youtube","piped"),setInterval((async()=>{n=ie("youtube"),t!==n&&(n&&await u(document.querySelector(Fe),"youtube","piped"),t=n)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(Q.Z.log("[entered] vk.com"),await oe(ve)){let e;await u(document.querySelector(ve),"vk",null);let n=ie("vk");setInterval((async()=>{if(e=ie("vk"),n!==e){if(e){const e=await oe(ve);e&&await u(e,"vk",null)}n=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))Q.Z.log("[entered] vimeo.com"),await oe(Le)&&(await ae(1e3),await u(document.querySelector(Le),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await ae(1e3),await u(document.querySelector(Me),"9gag",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",n=await oe(e);n&&await u(n,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await oe(Te);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await oe("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await oe(ye);if(e){let n,t=ie("twitter");await u(e,"twitter",null),setInterval((async()=>{n=ie("twitter"),t!==n&&(n&&await u(document.querySelector(ye),"twitter",null),t=n)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await oe(Ce);if(e){let n,t=ie("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{n=ie("mail.ru"),t!==n&&(n&&await u(document.querySelector(Ce),"mail.ru",null),t=n)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),b=n("./src/utils/debug.js");let f=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function y(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),y("#7A7A7D"),V(e);break;case"success":w(e),y("#A36EFF"),V(e);break;default:w("none"),y("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}f in v.Iz||(f="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[f].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[f].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[f].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[f].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[f].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[f].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const $={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},Z=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){b.Z.log("Loading extension..."),b.Z.log(`Selected menu language: ${f}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;b.Z.log("Inited requestVideoTranslation..."),b.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,y,V,w,L,F,M,z,A,q;b.Z.log("[translateProccessor] execute on element: ",n);let E,$=!0;b.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),b.Z.log("video",p);let Z=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",Z);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[f].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),b.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[f].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),b.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[f].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[f][t],value:e,selected:Z.detectedLanguage===e})))],t=[{label:v.Iz[f].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[f][t],value:e,selected:Z.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(e=>{b.Z.log("[onchange] select from language",e.target.value),Z=Y(Z,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(e=>{b.Z.log("[onchange] select to language",e.target.value),Z=W(Z,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[f].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[f].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[f].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[f].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,b.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[f].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[f].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,b.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[f].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,b.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[f].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,b.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[f].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,b.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[f].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,b.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[f].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,b.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}function U(e,t=f){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t)}function Y(e,t){switch(t){case"en":e.detectedLanguage=t,e.responseLanguage=f;break;case"ru":e.detectedLanguage=t,e.responseLanguage=f,"ru"==f&&(e.responseLanguage="en");break;default:if(!Object.keys(v.tW).includes(t))return Y(e,"en");e.detectedLanguage=t}return U(e.detectedLanguage,e.responseLanguage),e}function W(e,t){if("en"===t)e.responseLanguage=t,e.detectedLanguage="ru";else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===f&&(e.detectedLanguage="en"),e.responseLanguage=t}return U(e.detectedLanguage,e.responseLanguage),e}function G(){o.pause(),p.removeEventListener(".translate",G,!1),o.src="",o.removeAttribute("src"),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[f].translateVideo),g&&(p.volume=g)}function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(y=Number(e))}O("none",v.Iz[f].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=(e=!1)=>{if(b.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)b.Z.log(`lipsync mode is ${e}`),o.pause(),"playing"===e&&(b.Z.log("lipsync mode is playing"),o.play());else{b.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[f].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[f].neededAdditionalExtension:v.Iz[f].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else b.Z.log("lipsync mode is not set")};function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);y=e;const t=x("VOTVideoSlider",e,`${v.Iz[f].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,y);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,y=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{b.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(ee=Y(ee,ee.detectedLanguage),b.Z.log("VideoValidator videoData: ",Z),1===z&&ee.detectedLanguage===f)throw $=!1,v.Iz[f].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[f].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[f].VOTPremiere;if(Z.duration>14400)throw v.Iz[f].VOTVideoIsTooLong}return!0}(),b.Z.log("Run translateFunc"),await ae(e,Z.detectedLanguage,Z.responseLanguage)};function ne(e){b.Z.log(`video ${e.type}`),J(e.type)}function oe(){G(),K()}function ae(t,a,i){!function(t,n,o,a,i){b.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?b.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,b.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[f].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[f].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[f].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[f].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[f].translationTakeAboutMinute:v.Iz[f].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[f].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[f].videoBeingTranslated)}})))}(`${v.g$[u]}${t}`,v.ey,a,i,(async(e,r)=>{if(b.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[f].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),$=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[f].disableTranslate),X(),function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;y=e;const t=x("VOTTranslationSlider",e,`${v.Iz[f].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),y=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);b.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,n)))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(b.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return b.Z.log("[click translationBtn] audio.src is not empty"),void G();try{b.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[f].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!$||1!==w)return;const t=I(u);if(!t)throw v.Iz[f].VOTNoVideoIDFound;try{await te(t),$=!1}catch(e){O("error",String(e).substring(4,e.length)),$=!1}}))}await async function(){if(b.Z.log("Runned initWebsite function"),$.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}b.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(Z);if(e)b.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void b.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{b.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(b.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(b.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){b.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}b.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return b.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return b.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))b.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){b.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(b.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))b.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot-cloudflare.user.js b/dist/vot-cloudflare.user.js index e0c2b238..6b36b78a 100644 --- a/dist/vot-cloudflare.user.js +++ b/dist/vot-cloudflare.user.js @@ -13,7 +13,7 @@ // @description:it Una piccola estensione che aggiunge la traduzione vocale del video dal browser Yandex ad altri browser // @description:ru Небольшое расширение, которое добавляет закадровый перевод видео из Яндекс Браузера в другие браузеры // @description:zh 一个小扩展,它增加了视频从Yandex浏览器到其他浏览器的画外音翻译 -// @version 1.3.3 +// @version 1.3.4-testing // @author sodapng, mynovelhost, Toil, SashaXser // @supportURL https://github.com/ilyhalight/voice-over-translation/issues // @match *://*.youtube.com/* @@ -777,6 +777,7 @@ const siteTranslates = { rutube: "https://rutube.ru/video/", "bilibili.com": "https://www.bilibili.com/video/", "mail.ru": "https://my.mail.ru/", + coub: "https://coub.com/view/" }; const translations = { ru: { @@ -1339,6 +1340,7 @@ const VideoTranslationRequest = new protobuf.Type("VideoTranslationRequest") .add(new protobuf.Field("language", 8, "string")) // source language code .add(new protobuf.Field("unknown3", 9, "int32")) // 0 0 .add(new protobuf.Field("unknown4", 10, "int32")) // 0 0 + .add(new protobuf.Field("translationHelp", 11, "int32")) // array for translation assistance ([0] -> {2: link to video, 1: "video_file_url"}, [1] -> {2: link to subtitles, 1: "subtitles_file_url"}) .add(new protobuf.Field("responseLanguage", 14, "string")); // target language code // const VideoWhitelistStreamRequest = new protobuf.Type("VideoWhitelistStreamRequest") @@ -1556,25 +1558,24 @@ var update = injectStylesIntoStyleTag_default()(main/* default */.Z, options); /* harmony default export */ const styles_main = (main/* default */.Z && main/* default */.Z.locals ? main/* default */.Z.locals : undefined); -;// CONCATENATED MODULE: ./node_modules/tinyld/dist/tinyld.light.node.mjs -var D={TINYLD_CONFIG:"light"};var v=/[,.。,、#%&/\\+*¡!¿?[\]!?;:…„“«»”"“_–—~]/gi,S=/[0-9]/g,P=/[\uFF10-\uFF19]/g,N=/\s\s+/g,O=/’/gi,w=/[\u0300-\u036f]/g;function b(e){return typeof e=="string"||e instanceof String}function M(e){return e.toLowerCase().replace(O,"'").replace(v," ").replace(P,n=>String.fromCharCode(n.charCodeAt(0)-65248)).replace(S,"").replace(N," ").trim()}function j(e){return e.normalize("NFD").replace(w,"")}var C={light:{TRAINING_UNIQUE_GRAMS:[1,2,3,4],TOP_LANGUAGE_UNIQUE_GRAMS:60,TOP_LANGUAGE_STATS_GRAMS:50},normal:{TRAINING_UNIQUE_GRAMS:[1,2,3,4,5],TOP_LANGUAGE_UNIQUE_GRAMS:100,TOP_LANGUAGE_STATS_GRAMS:180},heavy:{TRAINING_UNIQUE_GRAMS:[1,2,3,4,5],TOP_LANGUAGE_UNIQUE_GRAMS:320,TOP_LANGUAGE_STATS_GRAMS:1024}},g=D.TINYLD_CONFIG||"normal",L=C[g].TRAINING_UNIQUE_GRAMS,o0=C[g].TOP_LANGUAGE_UNIQUE_GRAMS,t0=C[g].TOP_LANGUAGE_STATS_GRAMS,K=1e4;function d(e){return Math.round(e*K)/K}var k=e=>{let n={only:[],verbose:!1};return e?Object.assign(n,e):n},c={afr:{code:"af",region:"africa",name:"Afrikaans",skipLight:!0},amh:{code:"am",region:"africa",name:"Amharic",skipLight:!0,coefProb:0},ber:{code:"ber",region:"africa",name:"Berber",skipLight:!0,coefProb:.25},run:{code:"rn",region:"africa",name:"Kirundi",skipLight:!0},jpn:{code:"ja",region:"asia-east",name:"Japanese",alias:["jp"],coefProb:0},cmn:{code:"zh",region:"asia-east",name:"Chinese",alias:["cn"],coefProb:.25},kor:{code:"ko",region:"asia-east",name:"Korean",alias:["kr"],coefProb:0},mya:{code:"my",region:"asia",name:"Burmese",skipLight:!0,coefProb:0},tha:{code:"th",region:"asia",name:"Thai",coefProb:0},vie:{code:"vi",region:"asia",name:"Vietnamese",skipLight:!0,coefProb:0},ind:{code:"id",region:"asia",name:"Indonesian",skipLight:!0},khm:{code:"km",region:"asia",name:"Khmer",skipLight:!0,coefProb:0},tgl:{code:"tl",region:"asia",name:"Tagalog",skipLight:!0},ben:{code:"bn",region:"asia-south",name:"Bengali",coefProb:0},tam:{code:"ta",region:"asia-south",name:"Tamil",skipLight:!0,coefProb:0},hin:{code:"hi",region:"asia-south",name:"Hindi",coefProb:0},urd:{code:"ur",region:"asia-south",name:"Urdu",skipLight:!0,coefProb:0},guj:{code:"gu",region:"asia-south",name:"Gujarati",skipLight:!0,coefProb:0},kan:{code:"kn",region:"asia-south",name:"Kannada",skipLight:!0,coefProb:0},tel:{code:"te",region:"asia-south",name:"Telugu",skipLight:!0,coefProb:0},fra:{code:"fr",region:"europe-west",name:"French"},eng:{code:"en",region:"europe-west",name:"English",alias:["us","gb"]},deu:{code:"de",region:"europe-west",name:"German",coefProb:.5},spa:{code:"es",region:"europe-west",name:"Spanish"},por:{code:"pt",region:"europe-west",name:"Portuguese",alias:["po"]},ita:{code:"it",region:"europe-west",name:"Italian"},nld:{code:"nl",region:"europe-west",name:"Dutch"},gle:{code:"ga",region:"europe-west",name:"Irish",skipLight:!0},lat:{code:"la",region:"europe",name:"Latin",skipLight:!0},ces:{code:"cs",region:"europe",name:"Czech",skipLight:!0},srp:{code:"sr",region:"europe",name:"Serbian",skipLight:!0},ell:{code:"el",region:"europe",name:"Greek",alias:["gr"],coefProb:0},mkd:{code:"mk",region:"europe",name:"Macedonian",skipLight:!0,coefProb:1.5},slk:{code:"sk",region:"europe",name:"Slovak",skipLight:!0},dan:{code:"da",region:"europe-north",name:"Danish",skipLight:!0,coefProb:1.5},swe:{code:"sv",region:"europe-north",name:"Swedish"},fin:{code:"fi",region:"europe-north",name:"Finnish"},nob:{code:"no",region:"europe-north",name:"Norwegian",coefProb:1.5},isl:{code:"is",region:"europe-north",name:"Icelandic",skipLight:!0,coefProb:.5},hun:{code:"hu",region:"europe-east",name:"Hungarian"},ron:{code:"ro",region:"europe-east",name:"Romanian",coefProb:.5},bul:{code:"bg",region:"europe-east",name:"Bulgarian",skipLight:!0},bel:{code:"be",region:"europe-east",name:"Belarusian",skipLight:!0},rus:{code:"ru",region:"europe-east",name:"Russian"},ukr:{code:"uk",region:"europe-east",name:"Ukrainian",skipLight:!0},pol:{code:"pl",region:"europe-east",name:"Polish",coefProb:.5},lit:{code:"lt",region:"europe-east",name:"Lithuanian",skipLight:!0},est:{code:"et",region:"europe-east",name:"Estonian",skipLight:!0},lvs:{code:"lv",region:"europe-east",name:"Latvian",skipLight:!0},hye:{code:"hy",region:"middle-east",name:"Armenian",skipLight:!0,coefProb:0},tur:{code:"tr",region:"middle-east",name:"Turkish"},heb:{code:"he",region:"middle-east",name:"Hebrew",coefProb:0},yid:{code:"yi",region:"middle-east",name:"Yiddish",skipLight:!0,coefProb:.5},ara:{code:"ar",region:"middle-east",name:"Arabic",coefProb:0},pes:{code:"fa",region:"middle-east",name:"Persian",skipLight:!0,coefProb:0},tat:{code:"tt",region:"middle-east",name:"Tatar",skipLight:!0,coefProb:0},kaz:{code:"kk",region:"middle-east",name:"Kazakh",skipLight:!0},mon:{code:"mn",region:"middle-east",name:"Mongolian",skipLight:!0},tuk:{code:"tk",region:"middle-east",name:"Turkmen",skipLight:!0},epo:{code:"eo",region:"other",name:"Esperanto",skipLight:!0,coefProb:.5},vol:{code:"vo",region:"other",name:"Volapuk",skipLight:!0,coefProb:.5},tlh:{code:"tlh",region:"other",name:"Klingon",skipLight:!0,coefProb:.25}},H=new Set(Object.entries(c).filter(e=>g==="heavy"||g==="normal"||g==="light"&&!e[1].skipLight).map(e=>e[0])),h=[...H.values()],a0=Object.fromEntries(h.map((e,n)=>[e,n+1])),J=Object.fromEntries(h.map((e,n)=>[n+1,e]));function R(e){return e in c?c[e].region:""}function Q(e){return e in c?c[e].name:""}function U(e){let n=Object.entries(c).find(t=>t[1].code===e);if(n)return n[1].code;let o=Object.entries(c).find(t=>t[1].alias&&t[1].alias.includes(e));return o?o[1].code:""}function F(e){return e in c?c[e].code:e}function T(e){let n=Object.entries(c).find(t=>t[1].code===e);if(n)return n[0];let o=Object.entries(c).find(t=>t[1].alias&&t[1].alias.includes(e));return o?o[0]:""}var f={id:"tinyld-dict",multiples:{" '":"D07M0B"," aa":"B02D34G13"," aan":"DA9"," ac":"72F812907A3YB7VC1GD0GF06JEKM0U"," ace":"A18B0SJEKM0B"," ai":"73F809A08B21C2DG61J7AM0U"," all":"74J83H94XA11C6PD5QF6ZG0UH68I04M0C"," am ":"80U91WJG6"," are":"86UA04B05C0IJ5WL04"," at ":"84LA02D08H93M05"," att":"72K80Q902C1MFKTH04I0FM0D"," av ":"F5YHAJ"," az":"A0CB0BC06IJAJ0LL02M12"," az ":"IS8M0T"," be ":"87GF0AI31"," bir":"80EC11I09J0RMRC"," bli":"80490KD2AF2SH5IL0A"," bu ":"707MD7"," bun":"802903H05I03J4LM8V"," by":"81MF0RH0QL8N"," był":"L86"," c'":"75MC1N"," ce ":"7C9C0EJEM"," che":"74080T907A05B2KCO5D04F05J1JL02"," ci":"71580DA2XB2KC6ID02F04I0LJ5UL5OM0S"," com":"7BX83Z907ACUBKZCASD0UJ45"," con":"7A482ZAITBCQCFLD13J80"," cos":"704808A29B0SCIXJ0N"," cs":"I84"," csa":"IAK"," cu":"70V80LA8EB2DC22D02I07JGCL0AM09"," cu ":"JFJ"," cz":"LBQ"," czy":"L8V"," câ":"B08J84"," că":"JF8"," că ":"JIJ"," d'":"78TB02C0T"," da ":"91KA0LB7UC6LH1OJ0UL07M1L"," das":"9JRA03B1MD02"," dat":"70480A903A04B03C18DK0F0EH0SJ3EL02"," de ":"7SGASGBQWDRVF6KH7JI5FJSGM2H"," deg":"702803C0XD08H7UJ0D"," değ":"M9Z"," di ":"A09CPSH04"," did":"881"," die":"70M80N9LQA16B02C0XD67J05L03"," dig":"704802A0OB0WC05F6Y"," do ":"8BRB9QC02LAM"," don":"73E86X903A0UB05C0SD0DM08"," dov":"C8DJ0C"," du ":"77Q9CNFK1HM3"," dzi":"L83"," dé":"76IA0DB03I0A"," dü":"904I04M86"," e ":"A08BAPC5BI02J6I"," ee":"D9C"," een":"DP5"," egy":"803D03F02G02IQ2"," ei ":"902B02D02GHXH09J61"," ein":"9NHD0O"," el ":"APOI82JBXM08"," ela":"B8PI0Q"," ell":"7BLA8QD03F1QG06H27I2CM0D"," em ":"BB7"," en ":"7D2AM9D9FFH6GBVHJIM2Q"," er ":"9AWD8MF24HSCM02"," era":"A2YB2TC8VD09F09J6I"," es ":"71L9C0AKI"," est":"7KG803AQJBPDC10D02G09I1KJPIM03"," et ":"7ANG2PH8AM0I"," ett":"F7BGDGH32I0TM3Y"," eu ":"716BLEJ43"," ez":"IAFJ03M05"," ez ":"IE3"," fai":"7D780FC0FJ07"," faz":"B7KM1Y"," fö":"FF1I0R"," för":"FI0"," fø":"H23"," ger":"702809933A03B0JC0ND0ZF0DI03J0OM97"," gj":"F1OH3T"," gjø":"H5G"," gy":"F03I4G"," gå":"F4SH2D"," gö":"F41I05MAO"," gör":"F57I0AM8D"," ha ":"A3PCFSF2XH3CI7B"," hab":"70Z80399WA8PB08I05M0K"," hav":"87ZB0XD02F07G05H0EI0GM1C"," he ":"8C6A2JG40"," heb":"903A02B02DH2"," hee":"DD1"," her":"70287O92HA2FB06D1CF08G22H2ZI08L0DM71"," het":"DQKF0PG1IH0DI0I"," hij":"A1HDFL"," his":"70G86WA0QB0OF0DG0AH0MI25L0MM1D"," hj":"F25H1S"," ho ":"C9Y"," hog":"A04D07INN"," hon":"70H808902A0CB0BD25FC8G03I0KL02"," hun":"80J915A03D1DF1XG03HBCI03"," hv":"H8E"," hva":"H6S"," hvo":"H89"," hä":"910F9RGGY"," hän":"90GF1SGOM"," här":"FA7G03"," i'":"844"," ic":"71E8049BTF02L0JM02"," ich":"9NPL0S"," ih":"94PF0JG2SM1R"," ik":"DCMF05G1FHAKI02M29"," ik ":"DSG"," ikk":"G0KHMB"," il ":"7JVCKY"," in ":"8CU9AMCP2DGHF1CJ0A"," io":"B02C89J03"," io ":"CCM"," is ":"8FTDQJF03H05I9O"," iss":"80490AB8F"," ist":"9IXB1WC07F05G1AI0YJ0EL0CMBN"," it ":"881"," iç":"MBC"," içi":"MBB"," j'":"78W"," j'a":"7BH"," ja ":"90QD0EF0CGBYH0II05L1B"," jag":"903D02FSG"," jak":"G0DH06L8G"," je ":"7QE90EDN0L0L"," jeg":"HSGI0KL2P"," jes":"805A03B03F02LN0"," kel":"903D03G1EIBSL02M0I"," kj":"F02H2C"," kn":"849906D07F0OH09"," kno":"86F904D07"," kom":"92YD43F8KG0KH6UI0XL18M10"," kä":"906F2EG65"," ké":"I6F"," kö":"91CF2BG0AI5TM2K"," l'":"7D8C6R"," l'a":"7ACC3S"," le ":"7O2A71CBKF02I2MJ1E"," les":"7HW80990JA13B03C03D0CG02H1QI4GL03"," ll":"A5B"," lo ":"ABKC6EH06"," los":"80S90CADJD09L03"," lä":"90IF5MG3Y"," mai":"77L808903B85C3YG1PI0AJDX"," me ":"77J874ADPB7JC3TD7MG38"," meg":"C14HB1IQXL02"," mi ":"A8LCB4H06I5SJ0NL59M56"," mig":"70680XA02C17F9TI02L02"," mij":"DD6J0BL02"," mit":"70697SA07B02C02F22GC7H1JI5T"," moe":"B04D9J"," mui":"B8ED05G24"," my":"703838F2WG26H19L2C"," má":"A54B0GI66"," már":"IAZ"," må":"F4UH2G"," mé":"71AA0FB0MI4I"," n'":"79SC03"," na ":"903B6QD0VI0NLEF"," nag":"70J902D05F03IA3L0J"," ne ":"7JPC21G1QI6OJ2ZM8Q"," nek":"H06ID2"," nem":"B13C0HD0NISFJ06M02"," nie":"70292PA0HC1HDN2G03LQT"," no ":"826APLB77C0NG0LL06"," noe":"D0AH7AM09"," non":"718806CSG"," nou":"7DUD09G11J2Q"," nu ":"702D2AF2PJS4"," nã":"BLO"," não":"BOG"," nä":"90DF3PG5K"," nå":"F4NH2C"," oc":"70K807A19B0UC10D03F6ZJ1PL12M02"," och":"A0AD08F8NJ10L0D"," of ":"8CFD2K"," og":"C21D06F03H6LL15"," og ":"HEI"," old":"80XI0QMA0"," ole":"GNML02"," oli":"A02C03D07F0AGFEI02L02"," om ":"D7WF8ZH6JJ0Z"," on ":"73X860GSGL58M0P"," onu":"MD6"," op ":"DB4"," opp":"705807C05D04G18H5B"," os ":"702A0OB8L"," ov":"80QA03B0BC06D1EF06G3KH1N"," pe ":"JF5"," pou":"7G1804B1R"," pow":"808L89"," prz":"LGN"," pue":"A97"," på":"FCSH7H"," på ":"FG6HGP"," q":"76F80H903ABABB7C5I"," qu":"7OD80Z905AQPBSGCIB"," qu'":"7A1"," qua":"73L806906B9SCCM"," que":"7O880L903ARRBSGCFQ"," qui":"78480ZA93B1CC3J"," qué":"A7V"," sch":"7028159FXC0ND6WF0BI03J1HL0C"," se ":"76NAEWBA7C3FF17GC2H1YI0XJA1"," she":"888G02"," si ":"74TA4NB0CC8DH1DJ05"," sie":"7069G7A3MC2KG1QH1FI0FL1C"," się":"LJL"," ska":"802F50G03H5AL0D"," sl":"80PC07D12F2VH1NJ0WM04"," sn":"809D0MF24H2AL04"," som":"72583U90AA0UB0WC0FD0OF7CG02HATJ0E"," son":"7B780K91JA4MB0SCFPF0HI02M4O"," su ":"704A8VC1AM0H"," sun":"80FG0UH07JFLM05"," sz":"IHAL53"," sze":"IGNL0N"," sä":"906F3ZG1V"," så":"F59H2X"," så ":"F4OH6M"," sö":"F0UG0LI0HMAA"," söy":"MAI"," să":"JPO"," să ":"JSD"," te ":"74FA7DB2VC1UDF0F0EG25H08I5SJ7ZL0W"," tha":"8LQC02D02"," the":"8SG90DD0L"," thi":"8CJ"," tie":"70J80490IAA4C05D0NG8XI04"," til":"803FB5G13HHKI09"," to ":"8QRH1NLG5"," tod":"81890DA8UB58G3Y"," tou":"7CB80C902D02G03"," tu ":"7CQ903A42B0XC3MJ2BL1V"," tud":"B23IFT"," tul":"704G9PH09I0D"," tä":"904F1BGDN"," um":"80291PBK5C08G02H05J0NL18M1D"," um ":"938BFJ"," uma":"902BBTC07J09L07M0F"," un ":"7GWAHNCGSJF1"," una":"804907AD8CB2I0CJ0T"," une":"7D5804908G0JJ15"," vad":"C3TD1AF6WI0OJ0C"," vag":"704A04B03C02IDR"," van":"704803A0JB03C3IDIJF0TG37H3AIHT"," ve ":"A0GC05M8F"," vi ":"A0KB0MC2HF9WH97"," vil":"715805A02B03C05F8TG0KH9OI28"," voc":"702A03BJYC0CD02J0A"," voi":"74Z806C3SGBNJ58"," vol":"71480490QA1RB1NC5BD2CF04H05IFJJ07M02"," voo":"B05DAT"," vou":"7H6B2Q"," vr":"71ID2BF02J6G"," vä":"F6CG42"," væ":"H2M"," vær":"H6J"," w ":"LD1"," wa":"7028CH97BA02B03D8OF02G02L1XM02"," was":"8D396KD9LL0H"," wat":"818DA4"," we ":"85MD9QL0B"," wh":"88WB02"," wie":"96ZD2NL86"," wir":"9B3"," wit":"86Q906D0GL05"," wo":"85K92WD26L22"," wy":"L8Z"," y ":"72JA8M"," yap":"MFB"," ye":"70F81KA05F02J04M8R"," you":"7028LO"," za":"908A0DB07C02D1VI0EJ07LELM6A"," ze":"91FB03C0AD5QI0AJ0LL2FM0W"," ze ":"DCCL1J"," zij":"DII"," zu":"989A03C06D0PI03L0C"," zu ":"9D5"," à":"73CB0Y"," à ":"7F0B37"," á":"A08B0EI2W"," ä":"90BFCOG13"," är":"904FOEG05"," är ":"FRS"," å":"F1MH6J"," å ":"F02H94"," ç":"70OM8P"," ço":"MAT"," çok":"M9Q"," è":"C5N"," è ":"CIM"," é":"727A21B4XD05H03I9Z"," é ":"BI9"," él":"70NA5YI2E"," él ":"A8XI0R"," és":"A0BB08I5O"," és ":"B0AICW"," ét":"76PI0I"," ê":"70N"," î":"JBJ"," în":"JQR"," în ":"JMV"," înt":"JCC"," ö":"905F1SI2KM50"," ø":"H18"," ü":"917I13M24"," ş":"J0EM61"," şe":"M8W"," şey":"M8F"," ż":"L5R"," że":"L8U"," że ":"LAM"," ș":"J49"," și":"J8Y"," și ":"JBW"," б":"KFE"," бы":"KFG"," был":"KCH"," в":"KQJ"," в ":"KJ7"," все":"K7D"," вы":"KF9"," вы ":"KD5"," д":"KHK"," до":"KCG"," за":"KFA"," зна":"KAI"," к":"KGJ"," ка":"KCG"," как":"KBV"," ко":"KCE"," м":"KM1"," мен":"KAA"," мн":"KCI"," мне":"KDC"," мо":"KET"," мы ":"K9E"," мэр":"K7K"," н":"KS4"," на":"KOV"," на ":"KGM"," не":"KSG"," не ":"KSG"," о":"KLC"," он":"KIF"," он ":"KE5"," она":"K8T"," п":"KR9"," по":"KSD"," пр":"KMB"," при":"KCM"," про":"KEF"," ра":"KCG"," с":"KQB"," ска":"K8F"," т":"KPP"," так":"K94"," те":"KBU"," теб":"KAT"," то":"KPV"," том":"KQN"," ты":"KEE"," ты ":"KIB"," хо":"KBV"," ч":"KEK"," чт":"KKA"," что":"KOQ"," эт":"KL4"," это":"KNI"," я":"KGE"," я ":"KQH"," 他":"2I4"," 他们":"2F5"," 你":"2IJ"," 你可以":"2R5"," 你知道":"2O9"," 她":"29B"," 如果":"2E7"," 如果你":"2SA"," 我":"2SG"," 我不":"2OU"," 我不想":"2O0"," 我不知":"2SD"," 我们":"2QU"," 我們":"2O2"," 我喜欢":"2P1"," 我在":"2CQ"," 我希望":"2PL"," 我想":"2I9"," 我的":"2IV"," 我知道":"2RE"," 我觉得":"2O9"," 汤":"261"," 汤姆":"2SG"," 汤姆不":"2OI"," 湯姆":"2MC"," 这":"26O","' ":"802902C0CD02I02","'a":"753C19L02M1D","'ai":"79OC02","'ai ":"7B4","'d":"80LM1N","'e":"73DC0GM04","'es":"7AHC0R","'est":"7ENC0E","'h":"70JC0H","'i":"71DC0IM08","'l":"80RM0F","'m":"814","'o":"70MC0B","'r":"80S","'s":"83K905D0C","'s ":"875908D0I","'t":"863M06","'t ":"8BS","'u":"70PC0BM3K","'un ":"73HM8K","'v":"80Q","'è":"C0K","'é":"70X","-a":"B02G05I02J4T","-a ":"B05J9K","-c":"70KB02","-l":"707802B0KJ0H","-v":"70TB02G02I02J03","a'":"809D03M16",aa:"90BDDZGD4I03L02M0R","aa ":"GJO",aan:"D5AGGL","aan ":"DE7GMY",aar:"90CB02D9PG0V","aar ":"90KDMG",aat:"904D2KG38L02M1O",abl:"72E81L902A41F02I0DJ08L03M05",aca:"70B803A1RB1LC16J1OL0IM9H",acc:"71R80JA0LC5GD02F06J0V",ach:"72581596DA0KB46C04D28J07L2M",aci:"70P805A5WB1LC1GI02J1JL1VM05","ado ":"AEOBB8C40",adı:"MB0","ag ":"80491FD2LFR8H1OI0JJ04",agy:"IBH",agyo:"ICV",aid:"71B837A02B02D02G0KI09J04",aik:"G8VI03",air:"76K80SA08B0TC02D04G0NI02M0G",ais:"7HE805902A09B8ZG9TJ02","ais ":"7JNA0BBAO",ait:"7DS80KG2QI09M07","ait ":"7JB80HD05G08I0MM06",akk:"D0GG1NH2KI15M2R",alc:"707802A0HB0BC47J0LL06M07",alı:"MAI","amo ":"A0EB0FCDVL0C",ando:"70E804A97BA4C8CD06I07J05",anno:"70680ECA6F07G0I","ant ":"7AE84R90ED1RF10H2MI0GJ1SL03",any:"82UI1SL1PM0N",anı:"MAY",aq:"707A0UB18",aqu:"710A2RB5A",arı:"MFI",ası:"MAT","ato ":"802A1KB1HCLFG04I02L05",att:"72M80S917C7BD09FJ8G4FH2VI22M1S","att ":"90CFLIH40I26","au ":"76S90PB08D04H02J9V",auf:"70894RF02L04","av ":"F52H4LJ0BM04","ave ":"70C88PA0IB0EC0KD02H0D",aw:"80OD02L5H","ay ":"702852A2KC0IM1L",aya:"708803A0YMBU","az ":"A0JB1KIGQJ0AL1YM4J",aze:"802B5MC02D02I02J06L0LM0Q",azi:"704805903B0BC5OD03I0BJ17L0CM0D",aç:"702B1FM2A",añ:"A1M",ać:"L4M","ać ":"L99",ağ:"M4L",ał:"LBO","ał ":"L8S",aş:"J08M62",aș:"J23",aț:"J20","ban ":"702802A19G02IG8M06","bb ":"F0HH07I4H","ben ":"7029AIA0KC04DCFF0CH0IIBNM83",bia:"803A0LB10C4EG02J08L0Y",bili:"70E809A0IB0FC0SI03J0OL0BMA4",bir:"808A0JB04C0OI04J0MMQH","bir ":"A0MB03MP9",bt:"803919A02D0EF04I02","bu ":"704L05MBU",bí:"A0MI0I",bø:"H0K","c'":"715C0F","ca ":"805A5EB6RC5NI05J60L1MM30",cas:"70Q80BA4VB59C30J30L02M0B",cer:"71H80GA51B3SC3VD02F08I05J4AL0CM0H","ch ":"70583I9MMA02B02C04D1CF6PL76","che ":"73K80396OA35B07CQ7D12J0H",chen:"7078059C9A03D0NF09",cho:"72W80V914A4PB3PD0WF06L41",cht:"9EFD4M","cht ":"9LXD9D","ci ":"72SB0HC6GI03J8EL52M15",cie:"71O809A39B10C0UD04F05J0SL8J",ció:"A59I0DL0G",cke:"70280O912F6U",cl:"70G80YA0QB0GC06D02J0M","co ":"702802A56B5FC60D02L4Q","com ":"BARL03",con:"77S81YAENBDQCC5D0DI02J5FL05","con ":"704A9TC8LI05",cont:"74680TA58B79C49D0KJ2N",cor:"72F80FA2GB3XC55D03J1PL05",cos:"703805A2TB1TCEHI02J0Q",cost:"703808A0WB0YCCHJ0N",cq:"C06",cs:"702802I9B",csa:"I4X",ct:"70R81PA16B03D0EJ1DL02",cu:"70V80QA4KB1NC20D06I05J8FL13M1D","cu ":"706JA2L0PM0H",cz:"LFV",czy:"LCZ","czy ":"L92",câ:"B02J2M",cê:"B4R","cê ":"BFB",cí:"A0FB03I03",có:"A0NB03I02L0B",că:"J7G","că ":"JJZ","d'":"720808C08M03",dad:"803A61B6BF0RM0I",dag:"902C09D12F45H2BI0C",dans:"79QD0CF0DH0HJ0AM0D",das:"999A2HB43C02F0AG09I08L08M0S","das ":"9EVA3QB4TD04F07G05","dat ":"703DKNF06G07I27J2V",dde:"806C03D0MF1JH2KI05M0R","dde ":"C02D0KF1LH5OM02","deg ":"H7UI0L","des ":"7BQ807934A3RB1GD04F1SG0MH09I0CJ0D","det ":"91DFOHG0MHPFI1QM02",dett:"704C4GF1KG0OH5QI1HM09",değ:"M8T",deği:"M9M",did:"70384IA18B0YC03I02M04","die ":"70I8079HZA1LC02D5AJ05",dig:"70680290QA0KB0TC05D1JF7PH2UI24","dig ":"90MD3XF7PH66I5A",dl:"80990BF0DH0II03L1L","dn'":"83U","dn't":"86Y",dos:"706A66B79C0EG09I06L0XM09","dos ":"707A8WB8HI04",dov:"C5FJ09",dt:"90AD0RF02H1EI2Z","dt ":"90BD14H1XI11",duğu:"M85",dz:"D02I04LEG",dzi:"LKJ",dzie:"LFS",dä:"902F0XG2I",då:"F0DH07",dé:"71SA0AF04H02I1D",dì:"C06",dí:"A10B02I0F",dó:"A0NB03I0FL07",dø:"H0O",dü:"903I0FM5O",dı:"MBL","dı ":"MBL","e'":"81MM07",ear:"83I902A0IB08C03J1E","eb ":"906A02C02D34J0CL04M02",ece:"70480FA4BB5TC0SD02F02I03J2LL08MCC",eci:"70P80LA3QB5NC1LD04F0HJ2HL2FM0B",eef:"D3M",eeft:"DB7",eel:"80L903D2OF02G13","een ":"83J905A07C03DRHGBPH05",eer:"808909A0OD4BG04H03","eer ":"80A90AA0VD8WH06",eft:"80ID3OF1HH04J04M03","eft ":"80XDCTH07","ego ":"803A17B0PC0BLFR",egy:"802F02H0KIFW","egy ":"ILW","ein ":"70H9HCD13G30H0AI03",eine:"70R9NGD0IG0VH0BI05",eir:"80Y908B69H02I02",eit:"807952A04B3BD0AG40H08I0A","ej ":"F0NI03L9Z","ek ":"80C902D23F0FH02IDUL3HME0",eke:"804902C02D1XF09G1AH09I7BJ03L04M1D","ele ":"91PA0NBDIC0MD1VG0XH1JI2QJCTL1BM0I",elig:"706806907A11B0HC06D09F05H6BI02J0HL08",ella:"809A7WC70D02F0NG7PI02M02",elle:"7J2808929A08C3ND20F25G4WH5GI6VM0L",enc:"74281LA4OB34C02I0QL0FM1W","ene ":"80390OA5AB02C3MD0JG0SHAUI1XJ0FM0O",enge:"70380590OB03D20F0WG03H72I4MM09",erc:"71I807A1AB13C5JI0FJ1KL0GM0L","ere ":"89L92JA1NB0CCF5D1WF02H7FI0XJ54M1L","ero ":"802AB0B3XCA2G0DL07",ery:"831G03L0TM06",esc:"70H80791NA4HB66C27D0JJ6A",está:"AB8BAN",esz:"I7ML7R","ete ":"80491CA0ZB0TC9QD0EF0MH0DI1CJ0ZM0I","ett ":"90LF8EH45IBZ",ette:"76P81D911C2ZD17F0HG4GHANIA4M0H",että:"GDJ","eu ":"72Z902BOVJ6F",eux:"78N","eux ":"7CV",ey:"82CA08G05M8V","ey ":"83UA0DB02C03M4U",ez:"72F90DA1CB19C0ID21I9UJ2LL23M1N","ez ":"782A2EB39I6OJ1QL1YM1Z",ezt:"I4L",eä:"G0N",eç:"702B0PM1Q",eñ:"A0L",eğ:"M6O",eği:"MEV",eğil:"M8S",eș:"J2L",eșt:"J80",fai:"78Y80AC09J04M02",faz:"B6BM1Q",fd:"D0L",fj:"F04H09","for ":"87KB07F02HE2",fs:"702908D07",fy:"F07H08",få:"F12H0R",fè:"702C04",fö:"F6RI0K",för:"FG8M02","för ":"FCB",fø:"H1K",fü:"91XI0E",gee:"D25","ger ":"72Y812921A09B04C0FD26F4HH9KI08J05M02",ggi:"802C4J",ght:"84F","ght ":"702871",gio:"706805902A0CB0FC5ZF02H03J03",gj:"F0MH2YI0R",gje:"H1MI05",gjø:"H2B",gjør:"H5Q",gs:"80I90WD0DF0OH11I0T",gt:"705921D0NF25H0RI18","gt ":"705926D0UF5SH0S",gv:"H08I0K",gy:"804F02G02H0EIMM","gy ":"805IMK",gye:"I6I",gyo:"I62",gå:"F23H1M",gö:"F1GI0CM47",gör:"F3YI05M7E",gü:"902A03I0AM3I",hab:"70Z80294BA5UB07I02M0M",hac:"707903A53F05L02","han ":"81RA13D02FFHG3AHF6","har ":"A0FB1NFG4HIEI05J04M06","hat ":"70L8MX986D05G0FI0VM0E",hav:"84JB1BD02F06G06H07I06M16",have:"87PB0KD05F06H07I03",hd:"802903G1WM02",heb:"903A02D53","heb ":"DB7",hee:"807C0BD3ZG0O",heef:"DAM","her ":"71R89B93HB0XH2NM4Y",here:"87T90CA03B0CC08D03G04","het ":"702DQGF1BG09H2HI3C",hey:"83MM0D",hij:"A0YD4Q","hij ":"DFK","his ":"7038CMJ0QM02",hj:"F0SG09H15",hje:"G08H1Q",hl:"80292QG05L03M0A",hm:"91CG0NL05M04","ho ":"819A3LB96C71G03L04",hog:"A05D02IBW",hogy:"IOC","hon ":"705928F9PG0GI19",hou:"708843B0UD1EG05",hr:"70480N965D0FG02L05M07","hr ":"94G",hre:"80P93ID07G06M04",ht:"8279A9D32G2BM15","ht ":"83W9BLD2K","hun ":"D1DG0MHA3",hv:"G08H5IM0B",hva:"G08H2QM08","hva ":"G06H6R",hve:"G02H1RM0L",hvo:"H3D",hvor:"H89",há:"A02B0MI2Z",hã:"B0F",hä:"910F3NG5S",hän:"90AF1EGHN","hän ":"GKG",häne:"GA2",här:"F7RG02","här ":"F9X",hå:"F0XH0F",hé:"70EA02C0XI0W",hö:"914F1JG03I09",hø:"H0X","i'":"827M0D",iac:"A03C4II02L0B",iam:"702804A08B18C9YG04I0BJ0GL0S",iamo:"A03B02CCY",iał:"L8P","ich ":"70380X9SGA02C04D2AL2Q",icht:"9LFD2V",ici:"72X80GA3MB20C4DD05F08I0CJ9ZL0JM0P","ido ":"A84B4WC0OL02",iedz:"L7I",iene:"90BA7WB02C0WD08G0MH05L0Z","iet ":"702807905DLBF0DG02H0PL03",igh:"70282ZC02D05F0SH11J02",igt:"70490KD07F53","igt ":"70390YD0RF6P",iin:"G9UJ0K","iin ":"GC9","ij ":"D81L0L",ijk:"D3I",ijn:"D87","ijn ":"DN9",ikk:"D07G6PHCOI04M0R",ikke:"D0RG0YHNRI06",inde:"703807933A07B07C03D3JF0CH0CI9EJ0YM5U",inge:"70780892UA06B03C0CD3AF60H86I09J0Q",inh:"903B93G07",inha:"702904B7L","ini ":"70FC20G1IJ0VMCC",inul:"GBJJ0Q",inun:"90GA02B02C02GAYJ0O",inä:"GBK","inä ":"GI2",iq:"70PA04B07","ire ":"7E380MA0CB05CFCD05G0AH0FI2AJ1DM07",isk:"803903D04F3JG2JH1WI0QL0SM09",iss:"74080M91ABAGC1UD0JF1VG6UH0TI1BM16",isso:"70PB99G06","ist ":"80T9K6D26F0FH1BJ0WL0HM06",ith:"70283XB02F02G02L02M03","ito ":"803A2PBA0C68G08","itt ":"90DF4QH6NI5U",ità:"C4G",itä:"907GDT","itä ":"GGE",iy:"MDH",iyo:"MIL",iyor:"MKC","iz ":"702A0OB1VM9Q",ià:"C08",iä:"G14",iç:"B0BM6B",içi:"MAF",için:"MBE",iè:"70N",ié:"70CA0PI16",ië:"D0F",iñ:"A0G",iò:"C0A",ió:"A3DI0KL0H","ió ":"A4EI0A",ión:"A6G","ión ":"A9N",iù:"C0W",ię:"LBV","ię ":"LH5",iğ:"M3S",iği:"M94",ił:"L4K",iş:"J02M3V","j'":"71U","j'a":"774","j'ai":"79W",jag:"FQD","jag ":"FSG",jd:"D14F06I0OL0L",jeg:"HHRI0DL2S","jeg ":"HSG",jest:"G0MLM6",jf:"D0GI02",jg:"D07L02",jk:"D2BF05I02L05","jk ":"D2B",jn:"D5II0BL0I","jn ":"D7O","jo ":"A43B0UG15H09",js:"D0BI0AL0Y",jt:"D08I1E",jv:"D0A",já:"B0LI3H",jä:"F1LG1I",jæ:"H08",jø:"H2I",jør:"H2P",kaa:"D0JGB7","kaa ":"G9I",kai:"G6LI0EM02","kan ":"D67FA6G1JH8PI0FM0M",kell:"903G2CIB9","ker ":"80A90PC02D2ZF7KHCUI05M09","ki ":"703A03B03C02G4MH02I5ZL5GM65",kj:"D04F05H2NI03",kje:"D05H2A",kjø:"H1J","kk ":"H29",kke:"D14G0YHEJI0PM07","kke ":"D06G02HNM",kla:"90GD0GF26G06H1TI04L0JM5A",kn:"825905D06F0TH0DI0TL0XM08",kno:"83L902D02L07M02",know:"86E",kom:"91ZD1MF6ZG0VH31I0ML17M0V",komm:"94HD03F6VG09H56I07",kor:"905D07F2CG1HH0FI4RL0KM1Q",ksi:"GAZH04L1LM14","ksi ":"GDQM05",kt:"91CD1YF2ZG05H2SI0UL2OM5D","kt ":"912D29F2SH17L0S",kte:"90ID0MF2LH1TI0CL03M4S",kv:"F0PH0II04",kw:"902D0HL0B",kä:"906F15G43",ké:"I52",kö:"90VF0ZG17I44M0Y",kı:"M4K","l'":"72VC2GM04","l'a":"76DC3D","lar ":"80F90DA2UB2WD08F5NH19J0JMAE",ları:"MBV",lc:"70280290EA08B03C14I0LJ0AL06M08",ldi:"807908A02C12D0AF1AH1MI04M5D",ldu:"902J06M9W",leri:"702905C02F02G03H06M97",lh:"702902B32F02G02H03I0Z",lho:"B5XI03","lig ":"90LD0KF2MH9JI0Q",lij:"D3EG0UI02J03L02",lijk:"D9Y",lik:"82U902D04F10G0TH2KI0IL0GM3S",lj:"D02F16G15H07I2A","lle ":"7IR931A0HC53D1AF5MGGRH9VM04",ller:"73080890YA08C0BD0MF3KG09H5OI05M0X",llä:"F03G91","llä ":"GDN",lma:"702A0AB0CC04D02F02G36I18J05MAM","los ":"70480490MAG6B1ID05G0ZI0AJ0JL02",lr:"807A02F06I0E","ls ":"74S80V92BD2BF0LH02",lui:"73BA04B06C4ED0FG0KJ8J","lui ":"74PB02C6WD03G04JD9",lw:"80BD02L09",lá:"A0AB0EI6D",lä:"90QF2SG4R","lä ":"F02GAF",lå:"F1FH0G",læ:"H0T",lé:"70XA0EB03I2X",lì:"C06",lí:"A0KB0EI0F",lö:"909F0XG0II0P",lø:"H0X",lă:"J26",lı:"M7Q","m'":"70N80CC02L02M4R","m'u":"M8S","m'un":"M8B",maa:"D2VG78M06","mai ":"702C40I0EJEE",mais:"782B8IG1H","mak ":"D02H04I02L03M8H",md:"903D0EF0AH02M20","med ":"80YF8WHB7I05",meg:"C0PH4LIEJL07","meg ":"HAXICL",mek:"G0NH03I0JL09M8Z","mek ":"I0CL0BM8F","mer ":"71C80G93SA1FB0YD23F6RH77I07L06M02",meu:"70GB59J2U",mig:"70580JA1WB2FC17D04F7FI02J03L03","mig ":"F9TI02",mij:"D3RJ06L03",mijn:"DA7",mind:"80J906B08D0DF0AH0CIE3M07",minä:"GB9","mit ":"708807979F0AG03ICJJ1M",mitä:"G9U",ml:"906D02F0HH0AI0JL05M1R",mma:"70F804902C0TD02F4UG1MH05I0H",mme:"77Z80E93PC0WD0HF58G7KH5KI0AM0A","mme ":"76190PC02D05F0CGAWH3U","mo ":"A6FB71CC8G0NL0K",moe:"B04D2V",mond:"72480F906C0OD0AIAYJ07","mos ":"AB3BAVI0HJ0Q",mt:"90QD0EF0RH0UI07J05L06",mui:"B6ZD02G19",muit:"B8EG09","my ":"835L7R",má:"A23B09I5K",már:"B03I4Q","már ":"I98",más:"A5TB0AI3O","más ":"A8QB0AI40",mã:"B0P",mä:"90DF0QG3S",må:"F1WH1W","må ":"F08H1N",mé:"70MA08B08I44",mí:"A0HB05I0H",mø:"H0J",mă:"J2Y",mı:"M5R","n'":"722866C0CM14","n't":"8BS","n't ":"8JF",naa:"D2MG1V",nagy:"IAD","nak ":"IGBL08M04",nb:"90BD0AF08H06I0OM02","nde ":"743931A3VB4IC1XD3MF69H3GJ4FM4K","ndo ":"804AE4BFICBZ",nek:"F02G0FH05IATL0FM0I","nek ":"ID8L0LM08",neke:"G03I9R","nem ":"93MB14ISGJ0AL0WM0F","nen ":"9DJA1AD8VF3KGKGH5FI0JM09",ngen:"70794GA06B04C07D4ZF60G03H78",nger:"72I812917C0PD1LF1RH6XI0QJ0B",nha:"802907B8LF02G0VI02","nha ":"B7WG0S",nho:"904B7KD02G0BI03",nich:"7029HRC02D02L0C","nie ":"70J91LC02D09F02I0ZJ17LSG",niet:"A03DLNL02","nin ":"F02G26M9Y",nlar:"M9D","nn ":"94SF0PH3EI06L02","nno ":"CA8L05",noe:"D0EH2ZM08",non:"71G804COCF02G0RI03","non ":"71ICSGG0LI07","nos ":"70UA7LB5TI14J0AL02",nou:"79980FB0SD02G0NJ1O",nous:"7CNG0U",now:"84JL2D","now ":"86W",nq:"70AA06B07C06",nsk:"F3EG2CH30","nte ":"73J92AAERBERCEGD0MFKMH2EI0OJ3S","nu ":"70YB02D0MF29G05JMAL0XMG5",nul:"708C0UG6OI1GJ48M03",null:"705902C1DGB4I03",nun:"90QA1LB28C08G6LI0EJ0YM94","nun ":"90AGAZM89","nut ":"D02F04GB6J0UL0BM02",nyt:"80MF08G5XH0AI0T","nyt ":"GA6I1M",nz:"91JA0FB02C1ND0CI0VJ09M08",ná:"B05I3E",nál:"I49",nã:"B64",não:"BLP","não ":"BOH",nä:"90BF1NG61","nä ":"GDF",nå:"F1PH1N",någ:"F4E",næ:"H09",nç:"707B0SM0N",né:"70UA07B02I3W",nó:"A08B0QI04L0B",nø:"H0I",nă:"J2E",nı:"M9X","nı ":"MBV","o'":"804C0AD05M05",oar:"804B07F04J9D",och:"714931A28B05C0AD0ZF6HJ0UL38","och ":"959D11F8NL03",ocê:"BH6","ocê ":"BHX",odo:"A4HB3GC0QG18I0GL1E","oe ":"802A02B03C02D1NG02H1P",oen:"B0FD1WF04G05H1L",oet:"A02B03C02D2FG08J02L02","of ":"876904B02D10",ogy:"803IC3","ogy ":"805INQ","oi ":"773B46C7MD07G5MJ5UL0D",oin:"72X832A03B02C03G5IJ05L03",oir:"75XG12",ois:"75N805A06B40C02G6MJ04L03",oit:"73EB1JD0TG7BJ03",oj:"A0JB0IF08G0RI04L4BM04",oldu:"I02MAA","ole ":"71I80I903A04B04C48D02GB2H0EL0P","oli ":"705C0VGAPI02J05L0L","olt ":"903F06H0AIBO","om'":"80OC07G02L04MBW","om'u":"M9Y","omi ":"B05C05F04GAUI5IL02M02",omm:"77880D924C0HD09F5NG1AH2UI0E",omme:"7AP80693JC0LD0HF5BG0FH6P","on'":"83XM23","on't":"86Y","ono ":"A0OB0GCJ3G0EL0E","ons ":"7BI81I902B09D2QF02","ont ":"7BI809902D0UF0JI13J06",oor:"80JD5G","oor ":"80VDB7",opp:"70980E902C1OD06F1OG1NH2TI02","oro ":"A0HB0IC8EG04L0D",orum:"902J05ME3","osa ":"703A24B18C8DG0CI08L04",oss:"71080K90CB4YC4SD04F1SG2WH1GI1L","ost ":"81Q905D0KF0DH0EI5IJBJL06M02",ostr:"A0JB0LCGKF03J0UL15","ott ":"90DF0UH08ICP","ou ":"71H8AJBHKD23J1E",oul:"72N84VG1AJ0O",ould:"88L","our ":"7CD85E",ous:"7K381UB04G0S","ous ":"7QP81LG07",out:"76K840B20D0BF02G0N","out ":"76186GD0P",ouv:"767B1AG03","ow ":"86KB02",owi:"806L8I",oy:"70G80EA1VM1K","oy ":"80CA5LM08",oz:"903A09B0DC0AD04I4BJ0BL2JM09","pas ":"7NKA0DB0ED0AF0OG06",pg:"D07H03","por ":"ACDB9GF04I02M0E",pou:"7AH803B1LG02",pour:"7DN803",powi:"L7U",prz:"LD2",prze:"LAN",przy:"L8S",pue:"A6S",pued:"A7I",py:"809G10L0NM02",pä:"908F03G2D",på:"F4UH4S","på ":"FCIH7D",pø:"H0F",pă:"J23","qu'":"77B",qua:"72G808903B8NC8V",que:"7LK80K904ANZBSDCB0","que ":"7OQ806ARCBRKC0W",quer:"70V903A28B88",ques:"73480LA0EB0DCBK",qui:"75S80PA81B5UC2J",qué:"70PA5C","qué ":"70RA7Y","r'":"804M04",rai:"79P810902A06B0XC1GG0KI04J08","rea ":"806A0GB04C06D02F02G02JC1",rec:"71780R91DA5CB72C0ZD0GF0GI03J4NL08M1H",rer:"71X80290YA0LB0QC0XD02F0JH2HJ0OM09","res ":"77K80K90SA8NB49D0GH18I0ZJ04L0AM02",rij:"B02D22J10",rj:"D02F0LG1JI10M03",rui:"70N804A0GB0EC7MD0SG03J0I",ruir:"704A05B04CBL","rum ":"926D04F0MJ0BL03MDZ",rw:"80390KD0EL10",rz:"912A06C05D0BI0MJ0ALDCM03",rze:"90LC03D03I0GLDD",rzy:"LAE",rà:"C0V",rá:"A1GB17I48",rä:"90MF2IG0U",rå:"F1VH0X",rè:"70U",ré:"71YA0UB04I1F",rí:"A2EB08I0C",ría:"A6MB0D","ría ":"A7S",rò:"C0U",ró:"A0NB0AI21L29",rö:"909F19G02I0T",rø:"H1H",rü:"918I13M2J",ră:"J4A","ră ":"J82",rı:"M7Z","s'":"70W802C05M04","s-":"71BB02I02J1E",saa:"B02G63M1K","sak ":"F0AI96M06",sco:"709808A0XB2WC4FD03J0VL02",sd:"902A08B03D06F04H05I0H",seg:"A1TB2UC2PF04H1XI1D",sei:"70Q947A09B2RC2HG1YH03I06J07","ser ":"73P80593KA2LB3FD05F2PH60I02L03M07",she:"855903D02F02G02I04","she ":"86Z",sic:"70380H93MA0RB0WC20J0KL02M02","sie ":"70E9FHC02D0KJ08L11","sin ":"70I803904A21F2TG9TH2PM5X",sinu:"GCBJ05",się:"LF3","się ":"LJI",sj:"D0EF0WH1JL06","sk ":"80HF1EH2OL04M02","ska ":"F8TG1UI0QL0J",ske:"80O902C02D03F18G2YH4SI09M0C",skj:"F0CH1O","sn'":"83H",sna:"802D04F1DH1QI0NL04M02","so ":"81B91ZA65BDOCBNG0IL04","som ":"B04F79HATI0R",sono:"B07CFS","ss ":"81Y94GF2LH1XI0F","ssa ":"709802B3KC1ZF0XGL5I0C",sse:"76S80V94CB7NC63D0VF0SG06H1RI0FM14","sse ":"74H91EB79C3YD06F02H1NI04","sso ":"BC7C7N",ssz:"I4N",ssä:"F02G6O","ssä ":"GAI","sti ":"B02C2UGA5I05M06","sto ":"905A4RB4RCCZF03G0FH0DL1C",stá:"A7LB8XI0A","stá ":"A81BA5",stä:"90EF2NG9I","stä ":"GB6","su ":"704A5WC0TG0DL12M0W",sunt:"A0AB09C04G08JEJ",sv:"903C0AD03F18G0BH13I04M02",sw:"80E906D03L1G",sz:"906INDLFB","sz ":"I7GL8Z",sza:"I4KL2O",sze:"903ID4L4V",szer:"IFSL06",szo:"I4BL0K",szt:"I4HL0Q",szé:"I4E",sá:"A03B07I2S",sã:"B10",sä:"907F1RG3S","sä ":"G8R",så:"F24H24","så ":"F41H35",sé:"70XA0KB05I3U",ség:"I4N",sì:"C0K",sí:"A0IB07I0Q",sö:"F0WG06I0NM42",söy:"M9A",söyl:"MAI",sø:"H0T",să:"JA3","să ":"JP5",sı:"M84",sın:"M92","t'":"70E81F902C03M02",taa:"904D1DGBNM02","taa ":"GD1",tai:"76K80KB0DC0PD02G4VI0CJ0N","tam ":"B0UIECJ09L1TM0W",tb:"802905A02D08F06H05I0QJ02M04",tc:"80FD02F02I05J04L06","ted ":"86VA1DH0FI39","tem ":"805909B6QD06IDHJ2NL51M02","tet ":"92XF28G09H5WI2CL03",tg:"907D09F02H02","th ":"70284YA02B02L02M02",tha:"7028DL904D02G06I0TM02",that:"8KNI1A","the ":"7028QB",ther:"70288H903D02",they:"86H",thi:"703891903M02",thin:"89L905",this:"86S",tid:"702A19B1GC07F3EH22J02M0A",tien:"71K807904A87C0DD0VF02G1HJ06","til ":"70680G902A0BB0DD08F04HFHJ07M04",till:"70981L907A0DD03FBDG0AH1A",tj:"D0IF0FH0BI0U",tk:"903D03F03G2YH02I0WL2BM0A",toi:"72GC0CG5SL04","tom'":"817G03L05MDE",tomi:"C02F03GIAI7HL04",tos:"704903A41B4RC0ZG2FI1UJ07L07M05",tou:"78F807B5UG06","tre ":"7EE802A17B12C3KF1VH24I0NJ3HM06",treb:"903C0NJC8",trui:"70GA09B08CBPD05J0B","ts ":"75S83C913D1RF16H0EI09","tt ":"90PFO9H70IEH",tta:"70E805906C4WF5UGDTH04I3EM0L","tte ":"76080294LC2ZD1BF0UG3BH96I4BM0G",tti:"70780J902C55D06F0RG6YH0HI05M72",tto:"707804CB1F0AG1UH04I03","tto ":"CEAF02G0B",ttä:"902GCR","ttä ":"GDI","tu ":"7BBA2PB0RC2AG1QJ1EL2HM1M",tw:"80E90YD0SL2N",tz:"92DD05",tà:"C1H","tà ":"C5K",tá:"A2IB2DI5A","tá ":"A5CB8H",tã:"B11",tä:"90IF1GGF4","tä ":"GNT",täm:"F0IG61",tämä:"G9W",tää:"GA5","tää ":"G9V",tå:"F0XH0U",té:"721A0EB0EI4Z","té ":"773A0UB19",tò:"C05",tó:"A0QB0AI2HL1I",tö:"905F0CG0WI38M03",tø:"H0F",tă:"J68","tă ":"JG5",tı:"M71","u'":"71I80O",ual:"70480M902A18B2AC4TG02J0FL05",uan:"71SA2RB57C3AG1PH05M03",uch:"71481793NA4AD0AL1F",ued:"804A6CB04J02",uer:"71M90QA5RB75C0AF02H05",ues:"72N80J904A3DB0FC7IG04H02",uest:"71180NA4BB09CBJG02",ugh:"82V902J05",uh:"70290LG1QH02I0CM0J","ui ":"786A0CB3SC6WD02G2LJBB",uie:"70H803A5PB03J59",uir:"70M804A0MB0OC7PG02J03",uire:"70S805B02CBP",uis:"76N803A0LB0XC07D1FG21",uit:"72L80KA0IB75C0BD2MG0LJ3E",uito:"A06B7BC0AJ06",uld:"84T90DB07D0BF07M1F",ull:"70580F902A09C1KD1NF48G93H1QI09M1D","uma ":"A06BD8C02G0EI02J09M0H",una:"703805903AA9B07C7TG2CI06J2TM1P","una ":"AE3B04CBLG1DJ3EM1L","und ":"81R9C1F1DH0SJ09",une:"7AJ805908A0AB02C0LG0ZH03J4QL05","une ":"7FQ804904C0EJ3S",unk:"80690EF0DG0OH07I58L0IM02","unk ":"808I9F",unn:"807902C07D0NF14G33H27","unt ":"80A902D1HF0DJD4",unu:"G1QJ1CMEA","unu ":"G02J06MC2",uo:"70IA03B03C3JG58L02",utt:"70380690HC4WF0IG78H17I02M0K",uu:"D0RG5F",uw:"D1ZL0Q","ux ":"7A6",uy:"70280CA12M3V",uz:"903A07B09C04D07I04J10L0GM2X",uá:"A0MI02",ué:"70DA20B0H","ué ":"715A5F",uí:"A0OB06",uò:"C0C",uğ:"M3G",uğu:"M8G","v'":"C04",vad:"A0DB0IC2ED0DF5DI0CJ0BM05","vad ":"F6YI03",vag:"706A03B08C08F04I5VJ02",vagy:"IDS",vai:"76E802A03B2QC2BG67I03","van ":"A0MDGZF06G4GIGPJ05M05","var ":"A0KB0RFCEHAII06M72","vat ":"D06F04GCVI05J0VM05",vd:"F06H09M0L","ver ":"72084M904A29B35C0LD4NF4ZH5UI05J05M12","vet ":"F3TG05H5JI2CM0L","vil ":"804A06B02H7M",vill:"717805A0AC05F68G0NH2HI0F",vl:"D0FF0BH03M0K",vn:"F03H0GI04","vo ":"A2HB2SC51G03",voc:"705A0EBH9C0DD02J0D",você:"BJX",voi:"75I806C2DG7OJ50",volt:"B1KC21D02IDFJ08",voo:"B04D34G02",voor:"DB7",vor:"706807921A1MB23C4UD0BF0JH3IJ4EM04",vou:"7E5804B2LD02",vous:"7JG805",vr:"712B0MC0PD1PF04H02I02J1TM0I",vv:"C0GI03",vá:"B07I3Y",vä:"F3EG46",vå:"F15H0L",væ:"H1T",vær:"H2W",vé:"70KA03B02I2Z",waa:"D2P",waar:"D93",wan:"83890OD0ML2P",war:"80M93ZC02D0QL1A",was:"87K93ND2PL0G","was ":"8BP97SD9DL0A",wat:"80OD2TL08","wat ":"D93L03",wd:"D06L18","we ":"835D30L1J",wee:"70480QC04D2KJ03L04",wh:"84L",wha:"83GB02",wie:"937D0PLE2",wil:"821914D23L0O",wir:"94UL02",wit:"83S904D06L0B",with:"86O",wn:"80OL1S",wo:"83292CD24L5L",wr:"80EL0T",ws:"80FD03L33",wy:"L6E",xa:"704805A05B0KD02F05J05",xc:"704805A04B03J03",xp:"70680FA0AB09J0A",xt:"70380D902A0CB06F05J04","y'":"80HM2E",yap:"I05MDO",yb:"809I0GL1FM0E",yc:"803F2FL3XM02",yck:"F6T",ycke:"F6Q","ye ":"703804A05H1LI0SM7Z",yg:"F0IH0FI04L14M0D",yh:"F02G17I09",yi:"80KG0NI2CM64","yi ":"G16I0UM9T",yk:"F06G1CH14I09L1ZM09",yle:"707804G0LI0DL0CMB8",ym:"702807902F07G12H05I0DL53M0D",yor:"702802A0OB02C02F03G03I0MJ03MRC","yor ":"A0JMH0",yoru:"MF8",you:"7028DI","you ":"8HL",yt:"80JF0FG41H0QI16L22","yt ":"F02G6BH03I0XL0R",yv:"F02G1DH04I0UM07",yy:"G1C",yö:"G1VI0AM06",yı:"M4L",ył:"L4H","z-":"70S","ze ":"70780A90QB0AC0OD4ZI0YJ1FL6VM2C",zer:"80290BB5YC09D03I6YJ08L11M1C",zere:"B02IAGM0A",zie:"90RC19D1PJ0DLCA",zij:"D5P",zijn:"DGG",zio:"B02C7OL0E",zion:"CALL08",zt:"916I8EL0J","zt ":"918I70",zu:"964A03B02C02D0II0UJ0SL22M0T","zu ":"95XL0KM0D",zw:"90RD0EL1Z",zy:"802LEPM06","zy ":"804LA5",zá:"A02I3U",zé:"I3I",ß:"90P",ße:"910",à:"71SB0EC13","à ":"73TB0QC2N",á:"A2OB2SIDM","á ":"A2NB46I11",áb:"A05B03I2U",ág:"A03B0AI37",ál:"A09B07I9K",án:"A1AI66",ár:"A08B0OI8U","ár ":"I55",ás:"A2HB0EI5X","ás ":"A7NB16I3G",át:"A06B06I77","át ":"I6B",â:"706B04J34M0B",ân:"B09J3Z",ã:"B4L","ã ":"B0I",ão:"BA3","ão ":"BS0",ä:"91MFDYGMG","ä ":"F02GKQ",äg:"907F1J",äh:"90SG1S",äi:"G2M",äk:"F0OG1G",äl:"90IF3OG2M",äm:"905F0ZG2C",ämä:"G6Z",än:"90ZF5FGBF","än ":"F2NGNO",änd:"90PF3P",äne:"903G67",är:"90QFFXG1K","är ":"FRUG03",äs:"90BF1AG2E",ät:"90YF2FG2Y",ätt:"90MF4NG23",äv:"F0BG1F",äy:"G20",ää:"G7Z","ää ":"GB6",ään:"GBF","ään ":"GGF",å:"F8XH5K","å ":"F7PHDU",åd:"F0KH0G",åg:"F2T",ågo:"F41",åk:"F0SH0I",ål:"F17H0J",ån:"F2PH0I",ång:"F43",åp:"F02H0F",år:"F33H3Q","år ":"F69H4L",ås:"F15H05",åt:"F1MH0Z",æ:"H0V",ær:"H3E",ære:"H2U",ç:"70IB1HM61","ç ":"M3F",ça:"70WB1GM3B",çi:"M5A",çin:"MAH","çin ":"MAR",ço:"706B0OM4H",çok:"M95","çok ":"MA9",çã:"B18",è:"71AC2O","è ":"C6A",èr:"719",ère:"764",ès:"70R","é ":"74LA3LB5BC0ZD02F04I0W",éc:"718A03B04I02",ée:"71I","ée ":"75J",ég:"70BI6T","ég ":"I55",ék:"I32",él:"70IA1WI6U","él ":"A5YI3F",ém:"70AA02B0SI14",én:"70AA0RD05H03I61",ép:"70PI2H",ér:"714A08B0AI81",ért:"I5V",és:"711A13B07I7V","és ":"72RA34B0MI6O",ét:"728A03B03I45",ê:"70WB2M","ê ":"B43",ên:"B0I",ês:"B1J","ês ":"B6H",êt:"71I",ë:"D05","ë ":"D0B",ì:"C0F","ì ":"C10",í:"A2XB0XI2F","í ":"A1ZB03",ía:"A4PB05","ía ":"ABLB02",íc:"A0DB0F",ít:"A05B04I3K",î:"707J50",în:"703J9M","în ":"JFS",ñ:"A0X",ña:"A13",ño:"A1H",ò:"C0T","ò ":"C1Z",ó:"A2SB0YI3TL4P","ó ":"A41B0FI3D",ól:"A0AB04I3BL0G","ól ":"I4SL0C",óm:"A0JI07",ón:"A33I0I","ón ":"A8FI07",ós:"A03B0VI0OL08",ô:"707B06",õ:"B07",õe:"B0I",ö:"915F7KG2BI4TM3Z","ö ":"F06G1A",ön:"915F0OG0LI3MM2G",ör:"90WF98G08I2SM3B","ör ":"903FBII0EM09",örs:"902F3R",öv:"F1QG02I12M04",öve:"F47I11",öy:"G0IM43",öyl:"MAC",öyle:"MAX",ø:"H33",ød:"H0Z",øk:"H0S",øl:"H0S",øm:"H0G",øn:"H11",øp:"H0P",ør:"H4D","ør ":"H27",øre:"H2H",øs:"H0R",øt:"H0Q",øv:"H0M",øy:"H12",ù:"706C0E","ù ":"70DC0X",ú:"A0KB0CI1I",ún:"A0KB05I04",û:"706",ü:"924I2XM80",üb:"91HM03",üc:"915M0C",ül:"908I4UM18",ün:"90LI2GM7P","ünk ":"I97",ür:"926I0CM3B",ă:"JGA","ă ":"JN9",ăr:"J36",ăt:"J1W",ą:"L5Z","ą ":"L82",ć:"L55","ć ":"LC4",ę:"LAM","ę ":"LHC",ğ:"M63",ği:"M95",ğin:"M8G",ğu:"M3T",ğı:"M5K",ı:"MIA","ı ":"MJR",ık:"M4Q",ıl:"M4N",ım:"M8D","ım ":"MEZ",ın:"MFG","ın ":"MFK",ınd:"M9C",ında:"MA4",ını:"MD9","ını ":"MB3",ır:"M6S",ıy:"M5K",ıyo:"MAH",ıyor:"MBU",ız:"M4Y",ış:"M42",ł:"LD6","ł ":"L9M",ła:"L7F",łe:"L66",łem:"L8V","łem ":"LCC",ło:"L5O",ń:"L11",ő:"I3H","ő ":"I36",œ:"704",ś:"L5Z","ś ":"L4S",ş:"J0HM73",şa:"J03M3L",şe:"J03M4F",şı:"M3O",ţ:"J0J",ű:"I0Q",ź:"L0Q",ż:"L6C",że:"L6F","że ":"L97",ș:"J4G",și:"J3U","și ":"J9Z",șt:"J4E",ști:"JAL",ț:"J47",ți:"J78","ți ":"JDV","̇":"M0I",а:"KPL","а ":"KQP","ает ":"K8F",ал:"KFF","ал ":"KEI",ать:"KHM","ать ":"KJY",б:"K8X",в:"KGE",во:"KDH",г:"K7J","гда ":"K8F",го:"KFL","го ":"KIF",гово:"K7T",д:"KDR","да ":"KBW",де:"KEC",дел:"KBG",дела:"KAA",е:"KQR","е ":"KSG","ебе ":"K7E",его:"KD0","его ":"KEP","ему ":"K8J",ен:"KFZ","еня ":"K9Q",ет:"KEY","ет ":"KH9","ешь ":"K8B",ж:"K55",з:"K7K",и:"KLO","и ":"KOL",ит:"KEI",ить:"KBZ","ить ":"KDO",й:"K5A","й ":"KFB",к:"KCN",ка:"KDZ",каза:"K8T","как ":"K8Q",ко:"KFV",л:"KH7","л ":"KFG","ла ":"KBG",ли:"KD3","ли ":"KFU",м:"KGY","м ":"KLY",меня:"KA4","мне ":"KD2","му ":"KB9",мэри:"K7J",н:"KNA",на:"KM8","на ":"KL5",не:"KO8","не ":"KSF",ни:"KGM",но:"KGF","но ":"KH9",о:"KSG","о ":"KSG",ов:"KD4",овор:"K7V",огда:"K7L","ого ":"KC5","ой ":"KE1",ом:"KKG","ом ":"KOQ",он:"KEA","он ":"KC6","она ":"K9G",ост:"KD5",п:"KBR",по:"KKF",пр:"KE6",про:"KDL",р:"KG0",ра:"KHG",ро:"KEM",с:"KJD",сказ:"K7O",ст:"KJO","сть ":"K7P","сь ":"KC0","ся ":"KIV",т:"KPL","т ":"KHV",та:"KD7",те:"KG3","те ":"KCM",то:"KSA","то ":"KRY",том:"KOJ","том ":"KO7","тся ":"KC4","ты ":"KFY",ть:"KIB","ть ":"KR5",у:"KCT","у ":"KIJ",ф:"K0T",х:"K3O",ц:"K1K",ч:"K84",что:"KKH","что ":"KLT",ш:"K4M",щ:"K19",ъ:"K05",ы:"K9R","ы ":"KJX",ь:"KAJ","ь ":"KP3","ься ":"K8D",э:"K3E","эри ":"K7I",это:"KJ4","это ":"KIC",ю:"K3E",я:"KBD","я ":"KRD",ё:"K2N","​":"207",一:"2H5",不:"2I1",不知道:"2DC",了:"2N1","了 ":"2I3",人:"2AJ","什么 ":"2E0",什么时候:"2Q1",他:"2JJ",你:"2K8","吗 ":"275","嗎 ":"25T",在:"2FQ",她:"29M","工作 ":"2C6",我:"2SG",我不知道:"2SG",我们:"27C",我的:"26P",是:"2JR",有:"2E7",汤姆:"27V",的:"2S3","的 ":"29E","的时候 ":"2RL",要:"28S"},uniques:{" aan":"d"," aic":"j"," aik":"g"," aiu":"c"," ao ":"b"," aos":"b"," as-":7," até":"b"," auf":9," auz":"j"," aí":"b"," aú":"a"," cee":"j"," chc":"l"," cs":"i"," ctr":"k"," cu ":"j"," cua":"a"," cóm":"a"," daa":"d"," dl":"l"," dzi":"l"," där":"f"," dår":"h"," dés":7," día":"a"," dón":"a"," död":"f"," ea ":"j"," ear":8," eat":8," een":"d"," eft":"f"," elä":"g"," em ":"b"," epl":"h"," etm":"m"," etw":9," ez ":"i"," ezt":"i"," fez":"b"," fi ":"j"," fiq":"b"," fje":"h"," gaa":"d"," gi ":"h"," gic":"f"," gik":"h"," gje":"h"," gân":"j"," göz":"m"," hje":"h"," hoz":"i"," htt":"k"," hv":"h"," há ":"b"," hâl":"m"," hög":"f"," i'":8," i-":"j"," iar":"j"," ied":"d"," iet":"d"," if ":8," iga":"i"," igj":"h"," ihn":9," iht":"m"," ik ":"d"," ilg":"m"," ilm":"g"," ils":7," ily":"i"," isn":8," it'":8," iub":"j"," iy":"m"," iş":"m"," já ":"b"," kje":"h"," ks":"l"," kt":"l"," kuo":"g"," kuu":"g"," kå":"h"," l-":"j"," lh":"b"," lj":"f"," lle":"a"," luu":"g"," lá ":"b"," låt":"f"," m'a":7," m-":"j"," mj":"f"," mni":"l"," muj":"a"," mè":7," n'a":7," n-a":"j"," ne-":"j"," når":"h"," nós":"b"," oam":"j"," ock":"f"," odp":"l"," og ":"h"," ogg":"c"," ogs":"h"," ohn":9," oik":"g"," olh":"b"," olm":"m"," op ":"d"," oth":8," oí":"a"," pe ":"j"," päi":"g"," rz":"l"," s'e":7," s-":"j"," sb":"c"," sd":"c"," sg":"c"," sje":"h"," szc":"l"," szü":"i"," te-":"j"," tiv":"b"," tym":"l"," työ":"g"," täm":"g"," tè":"c"," töb":"i"," tú ":"a"," túl":"i"," ucc":"c"," un'":"c"," uo":"c"," up ":8," usc":"c"," usk":"g"," v-":"j"," veu":7," vri":"d"," vro":"d"," vän":"f"," way":8," wij":"d"," wo ":9," ws":"l"," wur":9," xí":"b"," yh":"g"," yk":"g"," yl":"g"," ym":"g"," yri":"g"," ys":"g"," yü":"m"," za ":"l"," zas":"l"," zaw":"l"," zd":"l"," zi ":"j"," zij":"d"," zm":"l"," zn":"l"," zo ":"d"," zos":"l"," zr":"l"," zu ":9," |":6," ° ":"c"," ½":9," áll":"i"," án":"a"," äls":"f"," än ":"f"," är ":"f"," äta":"f"," äte":"f"," åk":"f"," åp":"h"," åt ":"f"," ça ":7," çal":"m"," ço":"m"," è ":"c"," é ":"b"," ért":"i"," éta":7," été":7," éx":"a"," éé":"d"," ír":"i"," îm":"j"," în":"j"," ôn":"b"," önc":"m"," öpp":"f"," öss":"i"," úg":"i"," új":"i"," ō":9," şe":"m"," şi ":"j"," şt":"j"," ।":6," २":6," ঈ":5," ঋ":5," ঔ":5," ৩":5," ৪":5," ৬":5," ৮":5," ―":"k"," ‟":9," №":"k"," ご":1," ウサギ":1," エレベ":1," コ":1," ジ":1," テ":1," ド":1," ネズミ":1," バ":1," パ":1," フ":1," ボ":1," マ":1," メ":1," 一人":1," 一日":1," 一般的":1," 不好意":2," 両親":1," 中国語":1," 二人":1," 交通事":1," 今 ":1," 今夜":1," 今度":1," 今晩":1," 今朝":1," 今週末":1," 他一":2," 他不":2," 他人":1," 他可能":2," 他在":2," 他把":2," 他有":2," 会議":1," 何時":1," 俺":1," 僕":1," 先週":1," 列車":1," 労働者":1," 北海道":1," 午前中":1," 博物館":1," 合衆国":1," 君":1," 因為":2," 地下鉄":1," 基本的":1," 外国":1," 多分 ":1," 大学":1," 大家":2," 如":2," 子":1," 実際":1," 宿題":1," 富士山":1," 少年":1," 心配":1," 我今":2," 我从来":2," 我从没":2," 我以":2," 我会":2," 我叔叔":2," 我只":2," 我可":2," 我和":2," 我哥哥":2," 我喜":2," 我妹妹":2," 我完全":2," 我就":2," 我希":2," 我弟弟":2," 我必須":2," 我必须":2," 我感觉":2," 我打算":2," 我把":2," 我无法":2," 我明":2," 我昨":2," 我更喜":2," 我最近":2," 我正在":2," 我没":2," 我無法":2," 我父":2," 我爸爸":2," 我現在":2," 我相信":2," 我看":2," 我知":2," 我能":2," 我覺得":2," 我觉":2," 我認為":2," 我认":2," 我讨厌":2," 我需":2," 我非常":2," 所以":2," 所有":2," 放課後":1," 政治家":1," 新聞":1," 旅行":1," 日曜":1," 昨夜":1," 是的 ":2," 時々 ":1," 晩ご飯":1," 最初":1," 最近 ":1," 最近彼":1," 月日":1," 有些人":2," 来週":1," 残念":1," 湯":2," 現在 ":1," 看護婦":1," 私":1," 科学者":1," 突然 ":1," 結婚":1," 結局":1," 萨米":2," 請":2," 警察官":1," 谢谢 ":2," 這":2," 那":2," 電話番":1," 電車":1," 風邪":1," 飛行":1," 갈 ":3," 같":3," 걱정":3," 걸":3," 결국 ":3," 결혼":3," 경찰":3," 계속":3," 곧 ":3," 공":3," 과학":3," 괜찮":3," 궁금":3," 날":3," 남":3," 넌 ":3," 널 ":3," 네":3," 년 ":3," 노래":3," 노력":3," 누":3," 당":3," 대":3," 더":3," 동":3," 돼 ":3," 되":3," 될 ":3," 두 ":3," 둘 ":3," 때":3," 떠났":3," 또 ":3," 많":3," 먹":3," 메":3," 몇 ":3," 모":3," 몰랐":3," 못":3," 문":3," 뭘 ":3," 미":3," 바":3," 방법":3," 배":3," 번역":3," 벌써 ":3," 본 ":3," 볼 ":3," 봐 ":3," 부":3," 비":3," 살":3," 새 ":3," 생":3," 선생":3," 소":3," 싶":3," 알":3," 언":3," 엄청 ":3," 영":3," 오":3," 완전":3," 왜":3," 운전":3," 음식":3," 음악":3," 잘":3," 재미":3," 저":3," 적":3," 전":3," 절대":3," 점심 ":3," 정":3," 조금":3," 좀":3," 죄송":3," 줄 ":3," 중":3," 줘 ":3," 진짜":3," 질문":3," 집":3," 참 ":3," 처음 ":3," 친구":3," 침대":3," 커피":3," 컴퓨":3," 큰 ":3," 텔레비":3," 파티":3," 프":3," 학교":3," 학생":3," 할":3," 함께":3," 항상":3," 행복":3," 훨씬 ":3," -":9,"'ae":"c","'ai ":7,"'aim":7,"'cl":8,"'d ":8,"'da":"m","'e-":"c","'ea":7,"'eb":"c","'ell":7,"'ep":"c","'eq":"c","'fb":"c","'ha ":"c","'ho ":"c","'hu":7,"'il ":7,"'j":"d","'k":"d","'ll":8,"'ni":"m","'on ":7,"'ou":7,"'ov":"c","'re ":8,"'uc":"c","'uf":"c","'ug":"c","'une":7,"'uo":"c","'uv":"c","'ve":8,"'y ":7,"'ye ":"m","'yi":"m","'à":7,"'á":"b","'â":7,"'è ":"c","'é":7,"'ê":7,"'î":7,"'ü":"m","(-":"k","(q":"b","(y":"a","(z":9,"-$":"n","-'":"m","-ai ":"j","-am ":"j","-ar ":"j","-au ":"j","-ce ":7,"-ell":7,"-il ":7,"-je ":7,"-l ":"j","-lh":"b","-lo ":"b","-là":7,"-me ":"b","-mi ":"j","-moi":7,"-t-":7,"-tu ":7,"-ul":"j","-vou":7,"-à":7,"-ã":"b","-ê":7,"-í":"b","-ó":"i","-ö":"i","-ş":"j","a'd":"m","a'y":"m","aag ":"d","aak ":"d",aakt:"d","aam ":"d",aav:"g",abg:9,acj:"l",acz:"l",adei:"b",afí:"a",agte:9,"agy ":"i",ahd:"g","ahr ":9,aike:"g",aior:"b","ais-":7,aiut:"c",aixo:"b",ajud:"b",alál:"i",amay:"m",ambé:"b","an't":8,apm:"m",aquí:"a",ardz:"l",areb:"c",arfö:"f",arum:9,arü:9,arş:"m",aszt:"i",atok:"i",atât:"j",aufe:9,augh:8,auj:7,autt:"g",avea:"j",avev:"c",avne:"h",avve:"c",avô:"b",ayac:"m",ayud:"a",ayó:"a",azla:"m","azt ":"i",azón:"a",azú:"a",aá:"i",aã:"b",aä:"g",aî:7,aö:"i",aún:"a",baix:"b",baş:"m",berä:"f",besz:"i",bge:9,"biz ":"m",bién:"a",blij:"d","bly ":8,brz:"l",brí:"a","bst ":9,buie:"j",bunu:"m",buon:"c",buu:"d","bym ":"l",bã:"b",bäs:"f",bäu:9,"bè ":"c",bém:"b","bí ":"a","bía ":"a",bî:7,bô:"b",börj:"f",bù:"c",büc:9,"c'es":7,"c'è":"c",cche:"c",ccia:"c",cció:"a",ceea:"j",cepu:"j",chce:"l",chg:9,chk:9,chod:"l",chä:9,chí:"a",chö:9,chü:9,ciod:"j",ciun:"j",ciut:"c",cji:"l",ckan:"f",cma:"j",cois:"b",coj:"a",colh:"b",conh:"b","cos'":"c",csa:"i",cse:"i",csi:"i",cuan:"a",cuch:"a",cuel:"a",cuen:"a",cug:"c",cuie:"j",cuol:"c",cuá:"a","cz ":"l",czas:"l","cze ":"l",czeg:"l",czek:"l",czn:"l",czo:"l",czu:"l",czy:"l",câi:"j",câm:"b",cât:"j",cã:"b",cä:9,cç:"b",cên:"b","cí ":"a","d'h":7,"d'v":8,"d'è":"c","d)":8,daag:"d",daar:"d",daq:"b",davv:"c",daví:"a",daş:"m",ddl:8,degl:"c",deia:"b",dein:9,deir:"b","deu ":"b",deut:9,dey:"m",didn:8,dijo:"a",dinh:"b",dly:8,"dn'":8,"don'":8,dovr:"c",dovu:"c",drik:"h",drz:"l",drí:"a",drü:9,"dta ":"i",dtam:"i","du-":"j",duw:"d",duy:"m","dzi ":"l",dzia:"l",dzie:"l",dzis:"l",dzo:"l",dzy:"l",dà:"c","dá-":"b",dã:"b","dä ":"g","dän ":"g",dät:"g","då ":"f",dål:"f",dè:7,dép:7,dê:"b","dí ":"a","día ":"a",días:"a",dîn:7,dô:"b",dörr:"f",dúv:"b",dû:7,"dü ":"m","dün ":"m",dō:9,"e'r":8,"e'v":8,eady:8,easc:"j",eaun:"j",eave:8,ebè:"c",ecek:"m",eceu:"b",ecir:"a",ecv:"j",ediy:"m",edzi:"l","eea ":"j",eeft:"d",efd:"d",egou:"b",egé:"i","ehe ":9,"ehr ":9,ehs:9,"eht ":9,einm:9,"eio ":"b",eix:"b",ejor:"a",ejó:"a","ekk ":"h",elbs:9,eliy:"m",ellä:"g",elq:7,emey:"m",emiy:"m",emps:7,"emu ":"l","en't":8,enx:"b",enía:"a",eopl:8,eoz:"c",epoi:"b",epui:7,erug:"d","es-t":7,"es-v":7,"esc ":"j",esoi:7,eszc:"l",euch:9,eux:7,"ev'":"c",evn:"h",ewh:8,eyec:"m","eyi ":"m","ezt ":"i",ezte:"i",ezza:"c",ezó:"a",eã:"b","eä ":"g",eça:"b","eço ":"b",eë:"d","eí ":"a",eía:"a",eíb:"a",eíd:"a",eî:"j",eïn:"d",eón:"a",eû:7,"e‘":9,"fa'":"c",fap:"j",faut:7,fazl:"m","fd ":"d","fde ":"d",fds:"d",feel:8,fej:"i",few:8,ffn:9,fft:9,fiec:"j",figl:"c",fikk:"h",filh:"b",flé:7,foar:"j",fois:7,forh:"h",frum:"j",frå:"f",frè:7,frü:9,fuer:"a",fuo:"c",fà:"c",fâr:"j",fã:"b",fäh:9,fåg:"f",fç:"m","fè ":"c",fèr:7,fía:"a",fô:"b",förs:"f",förä:"f",fû:7,füh:9,"g)":8,gaat:"d",ganh:"b",gdy:"l",gdz:"l",gece:"m",geef:"d",geht:9,gesa:9,geï:"d",ggh:"c","ggi ":"c",ggia:"c",ggs:8,ghb:8,ghl:8,giap:"c",gick:"f",gikk:"h",gioc:"c",giov:"c",gitm:"m",gjer:"h",glei:9,glez:"j",glio:"c",glöm:"f",glü:9,goed:"d",gof:"c",good:8,"gou ":"b",gråd:"h",grü:9,gså:"h",gth:8,guf:"c",guma:"b",guv:"j",gye:"i",gyi:"i",gynn:"h",gynt:"h",gyo:"i",gysz:"i","g ":9,gând:"j",gã:"b",gåe:"h",gån:"f",gè:7,gée:7,gía:"a",görm:"m",görü:"m",gù:"c","gún ":"a","gün ":"m",güz:"m","h)":9,hace:"a",haci:"a",hagy:"i",hci:"l",hdä:"g","he'":8,hear:8,hebb:"d","hed ":8,heef:"d","hey'":8,hiam:"c","hij ":"d",hijo:"a",hjem:"h",hjer:"h",hlen:9,hlt:9,hly:8,hlä:9,hnen:9,hnl:9,"ho'":8,hodz:"l",hogy:"i",homb:"a",houd:"d",houg:8,hoy:"a","hoz ":"i",hoş:"m",hrer:9,hrh:9,hrl:9,hrs:9,hrt:9,"hst ":9,http:"k",htä:"g",huo:"g",huvu:"f",huw:"d",hvé:"a",hyv:"g",hár:"i",hã:"b","hän ":"g",häne:"g","här ":"f",hål:"f",hån:"h",håp:"h",hç:"m","hí ":"a",hís:"a",hív:"i",hô:7,höv:"f",hō:9,hş:"m","h‘":9,"i'l":8,"i'm":8,"i'v":8,iacc:"c",iagg:"c",iapp:"c",ibt:9,icz:"l",idzi:"l",idä:"g","iec ":"l",iedy:"l",iedz:"l","iej ":"l",iejs:"l",ielä:"g",igje:"h",igk:9,igvi:"h",igå:"f","ihm ":9,ihmi:"g","ihn ":9,"ihr ":9,ihå:"f",iic:"j",iik:"g",iim:"g","iin ":"g",ijb:"d",ijd:"d",ijf:"d",ijg:"d",ijh:"d","ijk ":"d",ijke:"d","ijn ":"d",ijp:"d",ijt:"d",ijv:"d",ijz:"d",iliy:"m",ilye:"i",incs:"i",inál:"i",iní:"b",ioda:"j",ious:8,ioè:"c",irim:"m",irj:"g",irkl:9,"is-j":7,issz:"i",isä:"g","it's":8,"iu-":"b",iua:"j",iuc:"c",iune:"j",iuo:"c",iusc:"c",iuto:"c",ivät:"g",ixar:"b",iye:"m",iyi:"m",iyo:"m",izio:"c",ià:"c",iã:"b","iä ":"g",iça:"b",iço:"b",ièm:7,iée:7,"ién ":"a",iê:"b",ië:"d",ií:"i",iô:"b",iù:"c",iü:"i","iş ":"m",işe:"m",işi:"m","j'":7,"j-":"i",jaar:"d","jag ":"f",jahr:9,jds:"d",jdt:"d",jedz:"l","jeg ":"h",jego:"l",jelp:"h",jert:"h",jetz:9,jeun:7,"jf ":"d",jft:"d","jg ":"d",jge:"d",jgt:"d",jij:"d",jj:"i",jkh:"d",jks:"d",jkt:"d","jl ":"d",jls:"d",jnl:"d",jns:"d",jnt:"d",joit:"g",jota:"g",joue:7,"jp ":"d",jpe:"d",jpt:"d",jull:"d",juo:"g",juu:"g",jze:"d",jzi:"d",jà:7,jár:"i",ját:"i",jã:"b","jä ":"g",jälv:"f",jå:"h","jé ":"a",jól:"i","kaa ":"g",kauf:9,kijk:"d",kims:"m",kiş:"m",kjed:"h",kjel:"h",kjem:"h",kjen:"h",kjer:"h",kkä:"g",knew:8,know:8,kolm:"g",komt:"d",ksj:"h",kså:"f",kuin:"g",kvel:"h",kvä:"f",kâ:"m","kä ":"g",känd:"f",käv:"g",kåt:"h",kç:"m",kép:"i",kér:"i",kés:"i",két:"i","kö ":"g",köny:"i",köz:"i",kú:"i",kû:"m",kō:9,kş:"m","l'f":"c",laub:9,laş:"m",lbst:9,lcos:"c",lcun:"c","ldu ":"m",left:8,letz:9,"lf-":8,lfd:"d",lgd:"d",lgoz:"i",lgui:"a",lgum:"b",lgú:"a",ligv:"h",lijk:"d",liw:"l",lkä:"g","ll'a":"c","ll'e":"c","llä ":"g",lmay:"m",lmiy:"m",lox:"c",lsj:"d",ltc:"j",ltij:"d",ludz:"l",lvf:"h",lví:"a",lway:8,lyck:"f","lz ":9,lâng:"j",lã:"b",lära:"f",låd:"f",låg:"f","låt ":"f",lè:7,lên:"b","lí ":"a",lía:"a",lû:7,"m'u":"m","m'è":"c","m-v":"b",mawi:"l",mbié:"a","mdi ":"m",megt:"i",megy:"i",mehr:9,meir:"b",mejo:"a",melh:"b",meye:"m",meyi:"m",miei:"c",migh:8,migl:"c",mijn:"d","miz ":"m",miè:7,miş:"m",mjö:"f",mmt:9,mmä:"g","mo-":"b",moet:"d",moje:"l",mq:"c",mulh:"b",muut:"g","muy ":"a",myck:"f",mye:"h",myö:"g","m ":"b",mâi:"j",mânc:"j",mã:"b","mä ":"g",mås:"f",måte:"h",mèr:7,mée:7,mêm:7,"mí ":"a",mía:"a",mój:"l",möc:9,mún:"a",mû:7,müss:9,mş:"m","n'ai":7,"n'd":"m","n't ":8,"n'y":7,"n'è":"c",nagy:"i",namn:"f",nauc:"l",nció:"a",nehm:9,neue:9,next:8,nft:9,nfí:"a",nhec:"b","nho ":"b",nhv:"h",niej:"l",niin:"g",niy:"m",niè:7,nká:"i",nly:8,nnhe:"h",nnr:"h",nnsk:"h",nnst:9,"nnt ":9,nnte:9,nnå:"h",nodi:"d",nooi:"d",noth:8,nouv:7,"now ":8,noë:7,"nq ":7,nskj:"h","nu-":"j",nuev:"a",nung:9,nuov:"c",nuw:"d",nuş:"m",nvän:"f",nych:"l",nyel:"i",nyth:8,nyv:"i",nyá:"i","nz'":"c",nzio:"c","n­":9,"nál ":"i",nã:"b","nä ":"g",näi:"g",näk:"g",någ:"f","når ":"h",nçai:7,nças:"b",nè:7,née:7,nék:"i",néz:"i","nía ":"a",níc:"b","nós ":"b",nù:"c",nş:"m","n‘":9,"o'c":8,obú:"a",ocm:"j",ocui:"j",ocuk:"m",ocz:"l",odob:"l",odpo:"l",odzi:"l",oede:"d",oeg:"d",oek:"d",oesn:8,oew:"d",ofd:"d",oike:"g",oitt:"g",oiu:"j",oix:7,ojc:"l",ojeg:"l",olur:"m",omú:"a",onnt:9,ooit:"d",opd:"d",opg:"d",oruz:"m",osaa:"g",ossz:"i",otde:"j","ou'":8,ough:8,oujo:7,ould:8,ourq:7,ourr:7,ouw:"d",oué:7,"ov'":"c",ovre:"c",ovv:"c","ow'":8,owd:8,"owi ":"l",oyf:8,oyn:"m",oyé:7,ozw:"l",oã:"b",oå:"f",oça:"b",oço:"b","oè ":"c",oël:7,oír:"a",oî:7,oó:"b",où:7,oû:7,"o₂":9,palj:"g",panh:"b",paur:"c",peak:8,pegn:"c",peop:8,peó:"a","pf ":9,pfl:9,pge:"d",piè:7,pmak:"m",pmay:"m","po'":"c",poat:"j",pouv:7,powi:"l",prek:"d",prz:"l",prè:7,pued:"a",puhu:"g",puoi:"c",pués:"a",pyta:"l",pà:"c",pâi:"j",pã:"b",pè:7,pée:7,péu:"b",pôd:"b",pş:"m","q-":"i",qq:"c","qu'":7,qur:8,"quí ":"a","r-o ":"j",raag:"d",rawd:"l","re's":8,"ren'":8,reí:"a",rför:"f",rgd:"d",rijk:"d","rió ":"a",rjoi:"g",rkj:"h",rlf:8,rly:8,rmí:"a",rodz:"l",roun:8,"row ":8,rquo:7,rrow:8,rske:"h",rskj:"h",rsoa:"j",rsq:7,rsök:"f",ruik:"d",ruke:"h",rvä:"f",rykk:"h",rzt:9,rzy:"l","r­":9,rà:"c","rá-":"b",râd:"j",râs:"j",rã:"b",räff:"f",räg:9,räu:9,råg:"f",rån:"f","rè ":"c",rèr:7,"rí ":"a",rías:"a",rív:"b",rôl:7,rù:"c",rû:7,rō:9,"s'es":7,"s'il":7,"s's":8,"s'è":"c","saa ":"g",saan:"g",says:8,saí:"b",saú:"b",sciu:"c",scuc:"a",segí:"i",sehr:9,selb:9,setz:9,"seu ":"b",seul:7,"she ":8,shed:8,shl:8,shr:8,sicu:"c",siin:"g",siit:"g",siy:"m","siz ":"m",siä:"g",siè:7,sión:"a",sjuk:"f",sjö:"f",skje:"h",sks:8,"sn'":8,snil:"h",snö:"f",soas:"b",sotr:"a",spué:"a",ssoa:"b",ssza:"i",ssze:"i",suno:"c",suoi:"c",suur:"g",svå:"f",syy:"g",syö:"g",szab:"i",szik:"i",szy:"l",szá:"i",szé:"i",szí:"i",szül:"i","s­":9,sà:"c",sári:"b","sä ":"g",såd:"f",såg:"f",sè:7,sée:7,ség:"i",sê:"b","sí ":"a",sív:"b",sólo:"a",sô:"b",söy:"m",sù:"c",sû:7,süre:"m","t'v":8,"t'è":"c","t-ce":7,"t-il":7,"t-o ":"j","taa ":"g",tasj:"h",tci:"j",tdea:"j",teir:"b",temt:"h",tení:"a",tept:"j","teu ":"b",tfen:"m",thd:8,they:8,thre:8,tidl:"h",tilb:"h",tinh:"b",tiy:"m",tiè:7,tjen:"h",tly:8,tmek:"m",tmey:"m",tné:"i",toar:"j","tog ":"f",touj:7,tq:9,"tr-":"j",trl:"k",trz:"l",träd:"f",trè:7,ttaa:"g",ttè:"c",tuom:"g",tuvo:"a",tué:7,tvä:"f",två:"f","ty-":8,tylk:"l",tyy:"g","tze ":9,tzl:9,"tzt ":9,tzte:9,tzu:9,tà:"c","tá-":"b","tál ":"i",táx:"b",tâi:"j",tâl:"j",tâmp:"j",târ:"j","tât ":"j",tã:"b","tä ":"g",täi:"g",tåg:"f",tç:"m","tè ":"c",tée:7,ték:"i","tél ":"i",têm:"b",tên:"b","tí ":"a",tío:"a","tól ":"i",tóq:"b",tù:"c","tü ":"m","tün ":"m",tünk:"i",tō:9,"t‘":9,"u'a":7,"u'e":7,"u'i":7,"u'l":8,"u'o":7,"u'r":8,"u'u":7,"u'v":8,"u-i":"j","u-mi":"j",ualc:"c",uap:"a",uase:"b",ucru:"j",ucz:"l",udc:"c",udom:"i",udzi:"l",uede:"a",uego:"a",ueva:"a",uevo:"a",ufen:9,ufg:9,ufz:9,ught:8,ugü:"m",uii:"c",uink:"g",uiu:"b",uién:"a",uió:"a",ujb:"j",ujer:"a",ukaa:"g",umg:9,umne:"j","unn ":"h",unns:"h",unuz:"m",uoc:"c",uog:"c","urd'":7,ureu:7,urü:9,used:8,usst:9,uude:"g",uul:"g","uur ":"d",uuri:"g",uuta:"g",uutt:"g",uvez:7,"uvo ":"a",uvé:7,"uw ":"d",uwd:"d",uws:"d",uwt:"d","ux-":7,uyd:"m",uyor:"m",uyu:"m",uyó:"a",uán:"a",uã:"b",uä:9,uè:7,uée:7,"uém ":"b",uên:"b",uó:"a",uşu:"m","v'e":"c","v'è":"c","v-a":"j","vaa ":"g",vagy:"i",vaik:"g",való:"i",varf:"f","vec ":7,veie:"h",very:8,vesz:"i",veva:"c","vez-":7,vgj:"h",vij:"d",vió:"a","vn ":"h",vnet:"h",voas:"j",vogl:"c",voln:"i",voor:"d",votr:7,"vou ":"b",voul:7,vreb:"c",vreo:"j",vroe:"d",vrou:"d",vuel:"a",vuoi:"c",vuol:"c",vuto:"c",vver:"c",vvo:"c",vz:"m",vâr:"j",vã:"b","vä ":"g",väg:"f",väh:"g",väld:"f",vänd:"f","vät ":"g","vå ":"f",våk:"h",vån:"f",vè:7,vée:7,"vía ":"a",vî:7,"vô ":"b",vú:"i",vş:"m","w's":8,waar:"d",wahr:9,wasn:8,wav:8,ways:8,wcz:"l","we'":8,wea:8,weer:"d",weh:9,wf:8,whe:8,why:8,wia:"l",widz:"l",wiec:"l",wiek:"l",wiem:"l","wil ":"d","wir ":9,wird:9,wirk:9,with:8,"wl ":8,wly:8,woh:9,woi:"l",woj:"l","won'":8,woon:"d",woor:"d",woul:8,wró:"l",wsz:"l",wurd:9,wv:"d",www:"c",wyc:"l",wye:8,wyg:"l",wyj:"l",wyk:"l",wym:"l",wyp:"l",wys:"l",wz:"l",wá:"a",wä:9,wó:"l",wö:9,wü:9,xad:"b",xb:"i","xe-":"b",xed:8,xei:"b",xg:9,xk:9,xm:9,xou:"b",xr:"i",xs:9,xz:9,xã:"b",xíc:"b",xō:"a","y'l":8,"y'n":"m","y'r":8,"y'v":8,"y'y":"m",yaca:"m",yapt:"m",yaş:"m",yby:"l",yci:"l",ycka:"f",ycke:"f",yckl:"f",ycz:"l","ydi ":"m",yea:8,yece:"m",yeu:7,yfr:8,ygd:"h",yhd:"g",yht:"g","yim ":"m",yiy:"m",ykd:"h",ymr:"h",ynyt:"g",yord:"m",yoru:"m",your:8,yrit:"g",ythi:8,ytä:"g",yvin:"g",ywh:8,yâ:"m",yä:"g",yí:"i",yō:9,"z'a":"c","z'o":"c","z-v":7,zaws:"l",zco:"a",zcz:"l",zego:"l",ziec:"l",ziej:"l","zij ":"d",zijn:"d",zinh:"b",ziy:"m","zla ":"m",zoe:"d",zond:"d",zost:"l",zott:"i",zq:"a",zro:"l",ztá:"i",zuu:"d",zwei:9,zyb:"l",zyc:"l",zyj:"l",zyma:"l",zys:"l",zyt:"l",zyw:"l","zz'":"c","zzo ":"c",zzá:"i",zám:"i",zâm:"j",zã:"b",zä:9,zê:"b",zô:"b",zúc:"a","| ":6," =":9," i":9," p":7," u":9," w":"l"," z":"l",ª:"b","­b":9,"­d":9,"­s":9,"²'":"m","· ":"e",ºc:"a","½ ":9,ß:9,"à-":7,àq:"b",às:"b","à ":7,"á'":"i","á-l":"b",áa:"i",ább:"i","ád ":"i","ág ":"i",água:"b",áis:"a",ák:"i",áln:"i",álta:"i","ám ":"i",ána:"i",ány:"i",áo:"i","ár ":"i","ára ":"i",ário:"b",áro:"i",áso:"i","ást ":"i",ásá:"i","át ":"i",áts:"i",átt:"i",ável:"b",áy:"a",áá:"i",áé:"i",áí:"i",áó:"i",áú:"i",áü:"i","â ":"m",âc:7,âg:7,âh:"m","âi ":"j",âin:"j",âk:"m",âln:"j",âmpl:"j",ânca:"j","ând ":"j",ânz:"j",ârs:"j",ârt:"j",ârz:"j","âs ":"j",âu:"j",ây:"m","ã ":"b","ã-":"b",ãe:"b",ãos:"b",ãs:"b",ãz:"b","ä-":"g",äa:"g",äch:9,ädc:9,ädd:"f",äffa:"f",äga:"f",ägg:"f",ägt:9,ähd:"g",ähl:9,ähr:9,ähä:"g",äin:"g",äisi:"g",äit:"g",äiv:"g",äj:"g",äks:"g",äkt:"f",äkä:"g","äl ":"f",äldi:"f","äll ":"f",ällä:"g",älp:"f",älsk:"f","älv ":"f",älä:"g",ämn:"f",ämä:"g",ända:"f",änel:"g","äni ":"g",äny:"g",änä:"g",äq:9,ärn:"f","äsi ":"g",ästa:"f","äta ":"f","ätt ":"f",ätta:"f",ätz:9,ätä:"g",äuf:9,äum:9,ävi:"g",ävä:"g",äx:"f",äy:"g",äz:9,ää:"g",äö:"g",åa:"f",åb:"f",åda:"f",ådi:"h",åel:"h","åg ":"f",åga:"f",åge:"f",ågo:"f",ågr:"f",åh:"f",åka:"f",åkt:"f",åla:"f",åll:"f",åm:"f","ån ":"f",åna:"f",åned:"h",ång:"f",ånn:"h",åpn:"h",åra:"f","åre ":"h",årl:"h",årn:"h",åste:"f",åta:"f","åte ":"h",åtte:"h",åvi:"h",æ:"h","ç ":"m","ç'":"m","ças ":"b",çb:"m",çe:"m",çg:"m",çi:"m",çk:"m",çl:"m",çm:"m",çoc:"m",çok:"m",ços:"b",çou:"b",çr:"m",çs:"m",çt:"m",çy:"m",çá:"b",çã:"b",çç:"m",çó:"b",çö:"m",çú:"b",çü:"m",èb:7,èc:7,èd:7,èg:7,èl:7,èq:7,ès:7,èt:7,èv:7,"è ":"c","é'":"i",écl:7,écou:7,écr:7,ées:7,éfé:7,"ég ":"i","ék ":"i",éke:"i",élet:"i",éln:"i",éno:7,ény:"i",énz:"i","ért ":"i",ész:"i","ét ":"i",étai:7,étud:7,"été ":7,"éu ":"b",éâ:7,éç:7,één:"d",éü:"i","ê ":"b","ê-":"b",êb:"b",êc:7,êl:7,"êm ":"b","ême ":7,ênc:"b",ênd:"b",êni:"b",êp:7,ês:"b",êt:7,êu:"b",êv:7,êx:"b",ëe:"d",ëi:"d",ën:"d",ër:"d",ëz:"d",ì:"c","í-":"b",ían:"a",ík:"i",íng:"b","ío ":"a",íos:"a",íss:"b",íç:"b","î ":"m",îc:7,îi:"j","îl ":"j",îmb:"j",îmi:"j",împ:"j","în ":"j",înc:"j",înd:"j",înf:"j",îng:"j",înn:"j",înr:"j",îns:"j",înt:"j",înv:"j",ît:7,îş:"j",ïf:7,ïnt:"d",ñ:"a",ò:"c","ó-":"i",óa:"i",ócu:"b",óe:"i",óh:"i","ój ":"l","ólo ":"a","ómo ":"a",ónd:"a",óo:"i",ópr:"b",óry:"l",óu:"i",ów:"l",óá:"i",óé:"i",óí:"i",ôni:"b",ôp:7,ôq:"b",ôr:"b",ôs:"b",ôt:7,ôv:"b",õ:"b",öbb:"i",öch:9,öda:"f",öe:9,ögon:"f",öhn:9,öi:"g",öjd:"f",öjl:"f",önce:"m",önnt:9,öo:"g",öra:"f",örja:"f",örsö:"f",örté:"i",össz:"i",ötü:"m",öw:9,öyle:"m",öä:"g",öç:"m",öö:"g",öş:"m",ø:"h","ú-":"i",úe:"a",úgy:"i",úi:"i","új ":"i",úk:"i",úo:"a",úvi:"b",úy:"a","û ":7,ûl:7,ûr:7,ût:7,"ü'":"m",üch:9,ück:9,üen:"a",ühl:9,ühr:9,ünf:9,"ünk ":"i",ünm:"m",ünü:"m",ütf:"m",ütz:9,ütü:"m",üy:"m","üz ":"m",üç:"m",üé:"a",üí:"a",üş:"m",ā:8,ă:"j",ą:"l",ć:"l",ę:"l",ğ:"m","ī ":9,ı:"m",ł:"l",ń:"l","ō ":9,ōb:9,ōc:"a",ōg:9,ōk:9,ōs:9,ōt:9,ő:"i",œ:7,ś:"l","ş'":"m",şam:"m",şan:"m",şar:"m",şb:"m",şek:"m",şey:"m",şf:"m",şg:"m",şh:"m","şi-":"j",şim:"m",şk:"m",şl:"m",şm:"m",şr:"m",şs:"m",ştu:"m",şv:"m",şy:"m",şç:"m",şö:"m",şü:"m",şş:"m",š:"g",ţ:"j",ū:9,ű:"i",ź:"l",ż:"l",ș:"j",ț:"j","́":"k","̇":"m","΄":"e",ΐ:"e",ά:"e",έ:"e",ή:"e",ί:"e",α:"e",β:"e",γ:"e",δ:"e",ε:"e",ζ:"e",η:"e",θ:"e",ι:"e",κ:"e",λ:"e",μ:"e",ν:"e",ξ:"e",ο:"e",π:"e",ρ:"e",ς:"e",σ:"e",τ:"e",υ:"e",φ:"e",χ:"e",ψ:"e",ω:"e",ϊ:"e",ό:"e",ύ:"e",ώ:"e",а:"k",б:"k",в:"k",г:"k",д:"k",е:"k",ж:"k",з:"k",и:"k",й:"k",к:"k",л:"k",м:"k",н:"k",о:"k",п:"k",р:"k",с:"k",т:"k",у:"k",ф:"k",х:"k",ц:"k",ч:"k",ш:"k",щ:"k",ъ:"k",ы:"k",ь:"k",э:"k",ю:"k",я:"k",ё:"k",ѣ:"k","ְ":"n","ֱ":"n","ֲ":"n","ִ":"n","ֵ":"n","ֶ":"n","ַ":"n","ָ":"n","ֹ":"n","ֻ":"n","ּ":"n","ֽ":"n","־":"n","ׁ":"n","ׂ":"n",א:"n",ב:"n",ג:"n",ד:"n",ה:"n",ו:"n",ז:"n",ח:"n",ט:"n",י:"n",ך:"n",כ:"n",ל:"n",ם:"n",מ:"n",ן:"n",נ:"n",ס:"n",ע:"n",ף:"n",פ:"n",ץ:"n",צ:"n",ק:"n",ר:"n",ש:"n",ת:"n","׳":"n","״":"n","،":"o","؛":"o","؟":"o",ء:"o",آ:"o",أ:"o",ؤ:"o",إ:"o",ئ:"o",ا:"o",ب:"o",ة:"o",ت:"o",ث:"o",ج:"o",ح:"o",خ:"o",د:"o",ذ:"o",ر:"o",ز:"o",س:"o",ش:"o",ص:"o",ض:"o",ط:"o",ظ:"o",ع:"o",غ:"o",ـ:"o",ف:"o",ق:"o",ك:"o",ل:"o",م:"o",ن:"o",ه:"o",و:"o",ى:"o",ي:"o","ً":"o","ٌ":"o","ٍ":"o","َ":"o","ُ":"o","ِ":"o","ّ":"o","ْ":"o","٠":"o","١":"o","٩":"o",ٱ:"o",ک:"o",ی:"o","ँ":6,"ं":6,"ः ":6,अ:6,आ:6,इ:6,ई:6,उ:6,ऊ:6,ए:6,ऐ:6,ऑ:6,ओ:6,औ:6,क:6,ख:6,ग:6,घ:6,च:6,छ:6,ज:6,झ:6,ट:6,ठ:6,ड:6,ढ:6,ण:6,त:6,थ:6,द:6,ध:6,न:6,प:6,फ:6,ब:6,भ:6,म:6,य:6,र:6,ल:6,व:6,श:6,ष:6,स:6,ह:6,"़":6,"ा":6,"ि":6,"ी":6,"ु":6,"ू":6,"ृ":6,"ॅ":6,"े":6,"ै":6,"ॉ":6,"ो":6,"ौ":6,"्":6,"०":6,"१":6,"२ ":6,"५ ":6,"९":6,"ঁ":5,"ং":5,অ:5,আ:5,ই:5,উ:5,এ:5,ঐ:5,ও:5,ক:5,খ:5,গ:5,ঘ:5,ঙ:5,চ:5,ছ:5,জ:5,ঝ:5,ঞ:5,ট:5,ঠ:5,ড:5,ঢ:5,ণ:5,ত:5,থ:5,দ:5,ধ:5,ন:5,প:5,ফ:5,ব:5,ভ:5,ম:5,য:5,র:5,ল:5,শ:5,ষ:5,স:5,হ:5,"়":5,"া":5,"ি":5,"ী":5,"ু":5,"ূ":5,"ৃ":5,"ে":5,"ৈ":5,"ো":5,"ৌ":5,"্":5,"ৎ":5,"০":5,"১":5,"২":5,"৩ ":5,"৪ ":5,"৫":5,"৬ ":5,"৭":5,"৮ ":5,"৯":5,ก:4,ข:4,ค:4,ง:4,จ:4,ฉ:4,ช:4,ซ:4,ญ:4,ฎ:4,ฏ:4,ฐ:4,ณ:4,ด:4,ต:4,ถ:4,ท:4,ธ:4,น:4,บ:4,ป:4,ผ:4,ฝ:4,พ:4,ฟ:4,ภ:4,ม:4,ย:4,ร:4,ฤ:4,ล:4,ว:4,ศ:4,ษ:4,ส:4,ห:4,ฬ:4,อ:4,ฮ:4,ะ:4,"ั":4,า:4,ำ:4,"ิ":4,"ี":4,"ึ":4,"ื":4,"ุ":4,"ู":4,เ:4,แ:4,โ:4,ใ:4,ไ:4,ๆ:4,"็":4,"่":4,"้":4,"๊":4,"๋":4,"์":4,ὰ:"e",ὸ:"e","​e":"d","​v":"d","​y":"m","‌":5,"‏":"o","― ":"k","‘ ":9,"‘s":"d","‚":9,"‟ ":9,"‬":"o","‮":"o"," °":9,"№ ":"k","−":9,あ:1,い:1,う:1,え:1,お:1,か:1,が:1,き:1,く:1,け:1,こ:1,さ:1,し:1,じ:1,す:1,せ:1,そ:1,た:1,だ:1,ち:1,っ:1,つ:1,て:1,で:1,と:1,ど:1,な:1,に:1,ね:1,の:1,は:1,ば:1,へ行:1,べ:1,ま:1,み:1,め:1,も:1,ゃ:1,や:1,よ:1,ら:1,り:1,る:1,れ:1,ろ:1,わ:1,を:1,ん:1,ア:1,イ:1,オオカミ:1,カナダ:1,カ合衆国:1,キャプテ:1,ク:1,シャ:1,ジャ:1,ジョ:1,ス:1,タバコ:1,チョコ:1,ッ:1,ティ:1,テレ:1,ディズニ:1,ト:1,ニュ:1,プレゼ:1,プロジェ:1,ミュニケ:1,ム:1,ラ:1,リ:1,ル:1,レビ:1,ン:1,"・・・":1,ー:1,一下:2,一度:1,一日中:1,"一本書 ":2,一生懸:1,一番:1,一緒:1,一起:2,一週間:1,上げ:1,上手:1,"下雨 ":2,不会:2,不可能的:2,"不在家 ":2,不思議:1,不想:2,不是:2,不注意:1,不知:2,不能:2,不要:2,世界一周:1,世界上:2,世界中:1,世界大戦:1,世界平和:1,"东西 ":2,个:2,中華料理:1,为:2,丽:2,么:2,之:2,也:2,书:2,"了 ":2,了一:2,了他:2,了我:2,事務所:1,二次世界:1,交通渋滞:1,人々:1,人間:1,什:2,今天:2,"今日 ":1,仕事:1,"他 ":2,他是:2,他的:2,们:2,"任何人 ":2,会社:1,但:2,住在:2,"作 ":2,你:2,來:2,"個問題 ":2,"個小時 ":2,們:2,"候 ":2,做:2,儿:2,冷蔵庫:1,出発:1,到了:2,勉強:1,動車事故:1,医者:1,"去 ":2,"去学校 ":2,友達:1,发:2,可以:2,可俗話又:2,"可能的 ":2,名前:1,"名字 ":2,吗:2,吧:2,告诉:2,"呢 ":2,"咖啡 ":2,哪:2,"啊 ":2,嗎:2,"回家 ":2,図書館:1,在波士頓:2,在波士顿:2,"地方 ":2,"多少錢 ":2,"多少钱 ":2,大丈夫:1,大統領:1,天早上:2,天然資源:1,她:2,"好 ":2,好的:2,如果:2,姆:2,委員会:1,子供:1,"学习 ":2,学校へ:1,学生時代:1,孩:2,學:2,它:2,宇宙飛行:1,宙飛行士:1,家族:1,对:2,對:2,就是:2,工作:2,"巧克力 ":2,已:2,庁所在地:1,应该:2,开:2,弁護士:1,彼女:1,很:2,怎:2,息子:1,您:2,想要:2,"意思 ":2,"感兴趣 ":2,懸命勉:1,"我 ":2,我々:1,我一:2,我不:2,我在:2,我希望:2,我想:2,我是:2,我有:2,我的:2,我第一次:2,我要:2,我觉得:2,我需要:2,"房子 ":2,所有的:2,手伝:1,手紙:1,"打網球 ":2,打電話給:2,携帯電話:1,日本語:1,早寝早起:1,时:2,明天:2,明日:1,映画:1,昨天:2,昨日:1,是一:2,是不:2,"是多少 ":2,是我:2,時候:2,時間以上:1,晚:2,曜日:1,會:2,有一:2,有人:2,朋:2,本当:1,"来的 ":2,"東西 ":2,样:2,欢:2,歡:2,殺人事件:1,毎日:1,每:2,民主主義:1,気:1,汤:2,沒:2,没有:2,"波士頓 ":2,"波士顿 ":2,海外旅行:1,"游泳 ":2,澳大利亚:2,现:2,生懸命:1,"生活 ":2,的东西:2,的事:2,的人:2,的名字:2,"的問題 ":2,"的国家 ":2,的地方:2,"的城市 ":2,"的女人 ":2,"的想法 ":2,的房子:2,"的房間 ":2,"的故事 ":2,"的照片 ":2,"的話 ":2,"看电视 ":2,看起来:2,"看電視 ":2,県庁所在:1,真的:2,知道:2,私達:1,科学技術:1,第二次世:1,約束:1,经:2,给:2,而:2,自分:1,自動車:1,自己的:2,自己紹介:1,自転車:1,"色的 ":2,行方不明:1,裡:2,西班牙:2,见:2,言葉:1,計画:1,試験:1,誕生日:1,說:2,読む価値:1,话:2,语:2,说:2,请:2,跟:2,车:2,过:2,还:2,这:2,這個:2,運転:1,部屋:1,郵便局:1,"里 ":2,"重要 ":2,重要的:2,間違:1,"问题 ":2,间:2,電話番号:1,音楽:1,飛行機:1,高校時代:1,高速道路:1,麼:2,點:2,가:3,거:3,"건 ":3,"걸 ":3,것:3,게:3,"계속 ":3,고:3,"과 ":3,그:3,기:3,"까 ":3,나:3,난:3,내:3,너:3,"네 ":3,는:3,니:3,다:3,"더 ":3,"데 ":3,도:3,"든 ":3,들:3,라:3,로:3,를:3,리:3,마:3,만:3,말:3,"면 ":3,무:3,보:3,사:3,생각:3,서:3,선생님:3,세:3,수:3,스:3,시:3,신:3,아:3,안:3,않:3,야:3,어:3,없:3,었:3,에:3,여:3,오늘:3,"와 ":3,"왜 ":3,요:3,우:3,으:3,은:3,을:3,의:3,이:3,인:3,일:3,있:3,자:3,"절대 ":3,제:3,"좀 ":3,좋:3,주:3,지:3,"처럼 ":3,컴퓨터:3,"테 ":3,텔레비전:3,톰:3,프랑:3,하:3,한:3,"할 ":3,"함께 ":3,"항상 ":3,해:3,했:3,"히 ":3,"𝑥":9,"- ":9,";可俗話":2,"�":9}};var X=/([,,、。!¿?!?":;()「」{}„“«»”"“<>⋯《》*]|[.[\]\\])+/,Z=/[ ]+/;function W(e){return e.split(X)}function Y(e){return e.split(Z)}function y(e,n,o=!0){let t=[],a=o?" ".repeat(n-1)+e+" ".repeat(n-1):e;for(let s=0;s1)&&r.push(a[s+i]);let u=r.join("");u.trim().length>0&&u.length===n&&t.push(u)}return t}function x(e,n,o,t){for(let a of L){let s=y(e,a);for(let r of s){if(!o.has(r))continue;let A=F(n.uniques[r]);if(!(t.only.length>0&&!t.only.includes(A)))return t.verbose&&console.log(`[Pass 1] detectUniqueGrams ${a}-grams - match '${r}' to ${A}`),A}}return""}function q(e,n,o){let t=new Map,a=L.map(i=>y(e,i)).flat();o.verbose&&console.log("[Pass 2] DetectPotentialGrams",e,a);let s=new Set([...H.values()].filter(i=>o.only.length>0?o.only.includes(i)||o.only.includes(F(i)):!0));s.forEach(i=>t.set(i,0));for(let i of a){let I=j(i),l=n.multiples[I];if(!l)continue;let G=new Set(Object.keys(l)),m=[];for(let B of s)G.has(B)&&(t.set(B,(t.get(B)||0)+l[B]*I.length/4),m.push(`${B} = ${l[B]/1024*100}%`));o.verbose&&m.length>0&&console.log(`Gram '${I}'`,m)}let r=[...t.entries()];r.sort((i,I)=>I[1]-i[1]);let A=Math.max(...r.map(i=>i[1]))||1,u=r.slice(0,8).map(i=>({lang:F(i[0]),accuracy:1-d((A-i[1])/A),score:d(i[1])}));return o.verbose&&console.log("Result",e,u),u}function p(e,n,o,t){let a=W(e);a=a.map(i=>M(i)).filter(i=>!!i),a.sort((i,I)=>I.length-i.length),a=a.slice(0,7),n.verbose&&console.log("Analize chunks",a);let s=0,r={};for(let i of a){let I=x(i,o,t,n);if(I){r[I]=(r[I]||0)+1*i.length,s+=i.length;continue}let l=Y(i);for(let G of l)q(G,o,n).forEach(B=>{r[B.lang]=(r[B.lang]||0)+B.accuracy}),s+=G.length}let A=Object.entries(r).filter(i=>i[1]>0);A.sort((i,I)=>I[1]-i[1]);let u=A.map(i=>({lang:i[0],accuracy:i[1]/s}));return n.verbose&&console.log("Merge Results",u),u}var E=f,_={uniques:Object.fromEntries(Object.entries(E.uniques).map(e=>[e[0],J[parseInt(e[1].toString(),36)]])),multiples:Object.fromEntries(Object.entries(E.multiples).map(e=>{let n=Object.fromEntries(e[1].match(/(.{1,3})/g)?.map(o=>{let t=o.slice(0,1),a=o.slice(1);return[J[parseInt(t,36)],parseInt(a,36)]})||[]);return[e[0],n]}))},$=new Set(Object.keys(f.uniques));function C0(e,n){let o=e0(e,n);return o.length>0?o[0].lang:""}function e0(e,n){let o=k(n);return b(e)?p(e,o,_,$):[]} - ;// CONCATENATED MODULE: ./src/utils/getYTVideoData.js +async function detect(cleanText) { + const response = await fetch('https://rust-server-531j.onrender.com/detect', { + method: 'POST', + body: cleanText + }); + return await response.text(); +} - -// Get the language code from the response or the text -function getLanguage(player, response, title, description, author) { +async function getLanguage(player, response, title, description, author) { if (!window.location.hostname.includes("m.youtube.com")) { - // ! Experimental ! get lang from selected audio track if availabled const audioTracks = player.getAudioTrack(); - const trackInfo = audioTracks?.getLanguageInfo(); // get selected track info (id === "und" if tracks are not available) + const trackInfo = audioTracks?.getLanguageInfo(); if (trackInfo?.id !== "und") { return trackInfo.id.split(".")[0]; } } - // TODO: If the audio tracks will work fine, transfer the receipt of captions to the audioTracks variable - // Check if there is an automatic caption track in the response const captionTracks = response?.captions?.playerCaptionsTracklistRenderer?.captionTracks; if (captionTracks?.length) { @@ -1583,18 +1584,16 @@ function getLanguage(player, response, title, description, author) { return autoCaption.languageCode; } } - // If there is no caption track, use detect to get the language code from the text const text = [title, description, author].join(" "); - // Remove anything that is not a letter or a space in any language const cleanText = text .replace(/https?:\/\/\S+/g, "") .replace(/[^\p{L}\s]/gu, "") + .trim() .slice(0, 250); - return C0(cleanText); + return await detect(cleanText); } -// Get the video data from the player -function getYTVideoData() { +async function getYTVideoData() { const player = document.querySelector("#movie_player"); const data = player.getVideoData(); const response = player.getPlayerResponse(); @@ -1606,7 +1605,7 @@ function getYTVideoData() { title, description, author, - detectedLanguage: getLanguage(player, response, title, description, author), + detectedLanguage: await getLanguage(player, response, title, description, author), }; console.log("VOT Detected language: ", videoData.detectedLanguage); return videoData; @@ -1929,6 +1928,8 @@ const getVideoId = (service) => { return url.pathname; case "rutube": return url.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1]; + case "coub": + return url.pathname.match(/view\/([^/]+)/)?.[1]; case "bilibili.com": const bvid = url.searchParams.get("bvid"); if (bvid) { @@ -1943,6 +1944,13 @@ const getVideoId = (service) => { case "mail.ru": if (url.pathname.startsWith("/v/") || url.pathname.startsWith("/mail/")) { return url.pathname; + } else if (url.pathname.match(/video\/embed\/([^/]+)/)) { + const referer = document.querySelector('.b-video-controls__mymail-link'); + if (!referer) { + return false; + } + + return referer?.href.split('my.mail.ru')?.[1]; } default: return false; @@ -2451,6 +2459,8 @@ let translateFromLang = "en"; // default language of video let translateToLang = "ru"; // default language of audio response +let ytData = ""; + async function src_main() { debug/* default */.Z.log("Loading extension..."); debug/* default */.Z.log(`Selected menu language: ${lang}`); @@ -2626,7 +2636,7 @@ async function src_main() { debug/* default */.Z.log("video", video); - let videoData = getVideoData(); + let videoData = await getVideoData(); console.log("VOT Video Data: ", videoData); const container = @@ -3026,7 +3036,7 @@ async function src_main() { } } - function getVideoData() { + async function getVideoData() { const videoData = {}; videoData.duration = video?.duration || 0; @@ -3038,7 +3048,7 @@ async function src_main() { videoData.responseLanguage = translateToLang; if (window.location.hostname.includes("youtube.com")) { - let ytData = getYTVideoData(); + ytData = await getYTVideoData(); ytData = setDetectedLangauge(ytData, ytData.detectedLanguage); videoData.detectedLanguage = ytData.detectedLanguage; videoData.responseLanguage = ytData.responseLanguage; @@ -3091,26 +3101,14 @@ async function src_main() { } return; } - if (mode === "pause") { - debug/* default */.Z.log("lipsync mode is pause"); - audio.pause(); - } - if (mode === "stop") { - debug/* default */.Z.log("lipsync mode is stop"); - audio.pause(); - } - if (mode === "waiting") { - debug/* default */.Z.log("lipsync mode is waiting"); + if (mode === "pause" || "stop" || 0|| 0) { + debug/* default */.Z.log(`lipsync mode is ${mode}`); audio.pause(); } if (mode === "playing") { debug/* default */.Z.log("lipsync mode is playing"); audio.play(); } - if (mode === "abort") { - debug/* default */.Z.log("lipsync mode is abort"); - audio.pause(); - } }; function addVideoSlider() { @@ -3257,9 +3255,8 @@ async function src_main() { tempVolume = translationValue; } - function videoValidator() { + async function videoValidator() { if (window.location.hostname.includes("youtube.com")) { - let ytData = getYTVideoData(); ytData = setDetectedLangauge(ytData, ytData.detectedLanguage); debug/* default */.Z.log("VideoValidator videoData: ", videoData); if (dontTranslateYourLang === 1 && ytData.detectedLanguage === lang) { @@ -3281,16 +3278,17 @@ async function src_main() { return true; } - const translateExecutor = (VIDEO_ID) => { + const translateExecutor = async (VIDEO_ID) => { debug/* default */.Z.log("Run videoValidator"); - videoValidator(); + await videoValidator(); debug/* default */.Z.log("Run translateFunc"); - translateFunc( + await translateFunc( VIDEO_ID, videoData.detectedLanguage, videoData.responseLanguage ); }; + // Define a function to handle common events function handleVideoEvent(event) { @@ -3533,14 +3531,14 @@ async function src_main() { throw constants/* translations */.Iz[lang].VOTNoVideoIDFound; } - translateExecutor(VIDEO_ID); + await translateExecutor(VIDEO_ID); } catch (err) { transformBtn("error", String(err).substring(4, err.length)); console.error(err); } }); - video.addEventListener("progress", (event) => { + video.addEventListener("progress", async (event) => { event.stopPropagation(); if (!(firstPlay && dbAutoTranslate === 1)) { @@ -3553,7 +3551,7 @@ async function src_main() { } try { - translateExecutor(VIDEO_ID); + await translateExecutor(VIDEO_ID); firstPlay = false; } catch (err) { transformBtn("error", String(err).substring(4, err.length)); @@ -3787,6 +3785,13 @@ async function src_main() { "9gag", null ); + } else if (window.location.hostname.includes("coub.com")) { + await sleep(1000); + await translateProccessor( + document.querySelector('.viewer__player'), + "coub", + null + ); } else if (window.location.hostname.includes("rutube.ru")) { const elementSelector = window.location.pathname.includes("/play/embed") ? "#app > div > div" @@ -3861,7 +3866,6 @@ async function src_main() { src_main().catch((e) => { console.error(e); }); - })(); /******/ })() diff --git a/dist/vot-min.user.js b/dist/vot-min.user.js index 03ca1b87..efeecc3f 100644 --- a/dist/vot-min.user.js +++ b/dist/vot-min.user.js @@ -13,7 +13,7 @@ // @description:it Una piccola estensione che aggiunge la traduzione vocale del video dal browser Yandex ad altri browser // @description:ru Небольшое расширение, которое добавляет закадровый перевод видео из Яндекс Браузера в другие браузеры // @description:zh 一个小扩展,它增加了视频从Yandex浏览器到其他浏览器的画外音翻译 -// @version 1.3.3 +// @version 1.3.4-testing // @author sodapng, mynovelhost, Toil, SashaXser // @supportURL https://github.com/ilyhalight/voice-over-translation/issues // @match *://*.youtube.com/* @@ -83,4 +83,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,n,t)=>{t.d(n,{Z:()=>s});var a=t("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=t.n(a),i=t("./node_modules/css-loader/dist/runtime/api.js"),r=t.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var n=[];return n.toString=function(){return this.map((function(n){var t="",a=void 0!==n[5];return n[4]&&(t+="@supports (".concat(n[4],") {")),n[2]&&(t+="@media ".concat(n[2]," {")),a&&(t+="@layer".concat(n[5].length>0?" ".concat(n[5]):""," {")),t+=e(n),a&&(t+="}"),n[2]&&(t+="}"),n[4]&&(t+="}"),t})).join("")},n.i=function(e,t,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),t&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=t):u[2]=t),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),n.push(u))}},n}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var n=[];function t(e){for(var t=-1,a=0;a{var n={};e.exports=function(e,t){var a=function(e){if(void 0===n[e]){var t=document.querySelector(e);if(window.HTMLIFrameElement&&t instanceof window.HTMLIFrameElement)try{t=t.contentDocument.head}catch(e){t=null}n[e]=t}return n[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(t)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var n=document.createElement("style");return e.setAttributes(n,e.attributes),e.insert(n,e.options),n}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,n,t)=>{e.exports=function(e){var n=t.nc;n&&e.setAttribute("nonce",n)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var n=e.insertStyleElement(e);return{update:function(t){!function(e,n,t){var a="";t.supports&&(a+="@supports (".concat(t.supports,") {")),t.media&&(a+="@media ".concat(t.media," {"));var o=void 0!==t.layer;o&&(a+="@layer".concat(t.layer.length>0?" ".concat(t.layer):""," {")),a+=t.css,o&&(a+="}"),t.media&&(a+="}"),t.supports&&(a+="}");var i=t.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),n.styleTagTransform(a,e,n.options)}(n,e,t)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(n)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,n){if(n.styleSheet)n.styleSheet.cssText=e;else{for(;n.firstChild;)n.removeChild(n.firstChild);n.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,n,t)=>{t.d(n,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,n,t)=>{function a(e){const n=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?n:n.toUpperCase()}t.r(n),t.d(n,{default:()=>r});var o=t("./src/yandexRequests.js"),i=t("./src/config/config.js");const r=async function(e,n,t,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,n,t,r);try{const e=new TextEncoder("utf-8"),n=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),t=await window.crypto.subtle.sign("HMAC",n,d),o=Array.from(new Uint8Array(t),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,n,t)=>{t.d(n,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,n,t,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:n,firstRequest:!0,unknown1:t,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},n={};function t(a){var o=n[a];if(void 0!==o)return o.exports;var i=n[a]={id:a,exports:{}};return e[a](i,i.exports,t),i.exports}t.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return t.d(n,{a:n}),n},t.d=(e,n)=>{for(var a in n)t.o(n,a)&&!t.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:n[a]})},t.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.nc=void 0,(()=>{var e=t("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),n=t.n(e),a=t("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=t.n(a),i=t("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=t.n(i),s=t("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=t.n(s),d=t("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=t.n(d),c=t("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),m=t.n(c),g=t("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),p={};p.styleTagTransform=m(),p.setAttributes=l(),p.insert=r().bind(null,"head"),p.domAPI=o(),p.insertStyleElement=u(),n()(g.Z,p),g.Z&&g.Z.locals&&g.Z.locals;var h=/[,.。,、#%&/\\+*¡!¿?[\]!?;:…„“«»”"“_–—~]/gi,A=/[0-9]/g,b=/[\uFF10-\uFF19]/g,f=/\s\s+/g,B=/’/gi,I=/[\u0300-\u036f]/g;function F(e){return e.normalize("NFD").replace(I,"")}var D={light:{TRAINING_UNIQUE_GRAMS:[1,2,3,4],TOP_LANGUAGE_UNIQUE_GRAMS:60,TOP_LANGUAGE_STATS_GRAMS:50},normal:{TRAINING_UNIQUE_GRAMS:[1,2,3,4,5],TOP_LANGUAGE_UNIQUE_GRAMS:100,TOP_LANGUAGE_STATS_GRAMS:180},heavy:{TRAINING_UNIQUE_GRAMS:[1,2,3,4,5],TOP_LANGUAGE_UNIQUE_GRAMS:320,TOP_LANGUAGE_STATS_GRAMS:1024}},v="light",y=D[v].TRAINING_UNIQUE_GRAMS,L=(D[v].TOP_LANGUAGE_UNIQUE_GRAMS,D[v].TOP_LANGUAGE_STATS_GRAMS,1e4);function M(e){return Math.round(e*L)/L}var T=e=>{let n={only:[],verbose:!1};return e?Object.assign(n,e):n},C={afr:{code:"af",region:"africa",name:"Afrikaans",skipLight:!0},amh:{code:"am",region:"africa",name:"Amharic",skipLight:!0,coefProb:0},ber:{code:"ber",region:"africa",name:"Berber",skipLight:!0,coefProb:.25},run:{code:"rn",region:"africa",name:"Kirundi",skipLight:!0},jpn:{code:"ja",region:"asia-east",name:"Japanese",alias:["jp"],coefProb:0},cmn:{code:"zh",region:"asia-east",name:"Chinese",alias:["cn"],coefProb:.25},kor:{code:"ko",region:"asia-east",name:"Korean",alias:["kr"],coefProb:0},mya:{code:"my",region:"asia",name:"Burmese",skipLight:!0,coefProb:0},tha:{code:"th",region:"asia",name:"Thai",coefProb:0},vie:{code:"vi",region:"asia",name:"Vietnamese",skipLight:!0,coefProb:0},ind:{code:"id",region:"asia",name:"Indonesian",skipLight:!0},khm:{code:"km",region:"asia",name:"Khmer",skipLight:!0,coefProb:0},tgl:{code:"tl",region:"asia",name:"Tagalog",skipLight:!0},ben:{code:"bn",region:"asia-south",name:"Bengali",coefProb:0},tam:{code:"ta",region:"asia-south",name:"Tamil",skipLight:!0,coefProb:0},hin:{code:"hi",region:"asia-south",name:"Hindi",coefProb:0},urd:{code:"ur",region:"asia-south",name:"Urdu",skipLight:!0,coefProb:0},guj:{code:"gu",region:"asia-south",name:"Gujarati",skipLight:!0,coefProb:0},kan:{code:"kn",region:"asia-south",name:"Kannada",skipLight:!0,coefProb:0},tel:{code:"te",region:"asia-south",name:"Telugu",skipLight:!0,coefProb:0},fra:{code:"fr",region:"europe-west",name:"French"},eng:{code:"en",region:"europe-west",name:"English",alias:["us","gb"]},deu:{code:"de",region:"europe-west",name:"German",coefProb:.5},spa:{code:"es",region:"europe-west",name:"Spanish"},por:{code:"pt",region:"europe-west",name:"Portuguese",alias:["po"]},ita:{code:"it",region:"europe-west",name:"Italian"},nld:{code:"nl",region:"europe-west",name:"Dutch"},gle:{code:"ga",region:"europe-west",name:"Irish",skipLight:!0},lat:{code:"la",region:"europe",name:"Latin",skipLight:!0},ces:{code:"cs",region:"europe",name:"Czech",skipLight:!0},srp:{code:"sr",region:"europe",name:"Serbian",skipLight:!0},ell:{code:"el",region:"europe",name:"Greek",alias:["gr"],coefProb:0},mkd:{code:"mk",region:"europe",name:"Macedonian",skipLight:!0,coefProb:1.5},slk:{code:"sk",region:"europe",name:"Slovak",skipLight:!0},dan:{code:"da",region:"europe-north",name:"Danish",skipLight:!0,coefProb:1.5},swe:{code:"sv",region:"europe-north",name:"Swedish"},fin:{code:"fi",region:"europe-north",name:"Finnish"},nob:{code:"no",region:"europe-north",name:"Norwegian",coefProb:1.5},isl:{code:"is",region:"europe-north",name:"Icelandic",skipLight:!0,coefProb:.5},hun:{code:"hu",region:"europe-east",name:"Hungarian"},ron:{code:"ro",region:"europe-east",name:"Romanian",coefProb:.5},bul:{code:"bg",region:"europe-east",name:"Bulgarian",skipLight:!0},bel:{code:"be",region:"europe-east",name:"Belarusian",skipLight:!0},rus:{code:"ru",region:"europe-east",name:"Russian"},ukr:{code:"uk",region:"europe-east",name:"Ukrainian",skipLight:!0},pol:{code:"pl",region:"europe-east",name:"Polish",coefProb:.5},lit:{code:"lt",region:"europe-east",name:"Lithuanian",skipLight:!0},est:{code:"et",region:"europe-east",name:"Estonian",skipLight:!0},lvs:{code:"lv",region:"europe-east",name:"Latvian",skipLight:!0},hye:{code:"hy",region:"middle-east",name:"Armenian",skipLight:!0,coefProb:0},tur:{code:"tr",region:"middle-east",name:"Turkish"},heb:{code:"he",region:"middle-east",name:"Hebrew",coefProb:0},yid:{code:"yi",region:"middle-east",name:"Yiddish",skipLight:!0,coefProb:.5},ara:{code:"ar",region:"middle-east",name:"Arabic",coefProb:0},pes:{code:"fa",region:"middle-east",name:"Persian",skipLight:!0,coefProb:0},tat:{code:"tt",region:"middle-east",name:"Tatar",skipLight:!0,coefProb:0},kaz:{code:"kk",region:"middle-east",name:"Kazakh",skipLight:!0},mon:{code:"mn",region:"middle-east",name:"Mongolian",skipLight:!0},tuk:{code:"tk",region:"middle-east",name:"Turkmen",skipLight:!0},epo:{code:"eo",region:"other",name:"Esperanto",skipLight:!0,coefProb:.5},vol:{code:"vo",region:"other",name:"Volapuk",skipLight:!0,coefProb:.5},tlh:{code:"tlh",region:"other",name:"Klingon",skipLight:!0,coefProb:.25}},G=new Set(Object.entries(C).filter((e=>!e[1].skipLight)).map((e=>e[0]))),w=[...G.values()],V=(Object.fromEntries(w.map(((e,n)=>[e,n+1]))),Object.fromEntries(w.map(((e,n)=>[n+1,e]))));function k(e){return e in C?C[e].code:e}var H={id:"tinyld-dict",multiples:{" '":"D07M0B"," aa":"B02D34G13"," aan":"DA9"," ac":"72F812907A3YB7VC1GD0GF06JEKM0U"," ace":"A18B0SJEKM0B"," ai":"73F809A08B21C2DG61J7AM0U"," all":"74J83H94XA11C6PD5QF6ZG0UH68I04M0C"," am ":"80U91WJG6"," are":"86UA04B05C0IJ5WL04"," at ":"84LA02D08H93M05"," att":"72K80Q902C1MFKTH04I0FM0D"," av ":"F5YHAJ"," az":"A0CB0BC06IJAJ0LL02M12"," az ":"IS8M0T"," be ":"87GF0AI31"," bir":"80EC11I09J0RMRC"," bli":"80490KD2AF2SH5IL0A"," bu ":"707MD7"," bun":"802903H05I03J4LM8V"," by":"81MF0RH0QL8N"," był":"L86"," c'":"75MC1N"," ce ":"7C9C0EJEM"," che":"74080T907A05B2KCO5D04F05J1JL02"," ci":"71580DA2XB2KC6ID02F04I0LJ5UL5OM0S"," com":"7BX83Z907ACUBKZCASD0UJ45"," con":"7A482ZAITBCQCFLD13J80"," cos":"704808A29B0SCIXJ0N"," cs":"I84"," csa":"IAK"," cu":"70V80LA8EB2DC22D02I07JGCL0AM09"," cu ":"JFJ"," cz":"LBQ"," czy":"L8V"," câ":"B08J84"," că":"JF8"," că ":"JIJ"," d'":"78TB02C0T"," da ":"91KA0LB7UC6LH1OJ0UL07M1L"," das":"9JRA03B1MD02"," dat":"70480A903A04B03C18DK0F0EH0SJ3EL02"," de ":"7SGASGBQWDRVF6KH7JI5FJSGM2H"," deg":"702803C0XD08H7UJ0D"," değ":"M9Z"," di ":"A09CPSH04"," did":"881"," die":"70M80N9LQA16B02C0XD67J05L03"," dig":"704802A0OB0WC05F6Y"," do ":"8BRB9QC02LAM"," don":"73E86X903A0UB05C0SD0DM08"," dov":"C8DJ0C"," du ":"77Q9CNFK1HM3"," dzi":"L83"," dé":"76IA0DB03I0A"," dü":"904I04M86"," e ":"A08BAPC5BI02J6I"," ee":"D9C"," een":"DP5"," egy":"803D03F02G02IQ2"," ei ":"902B02D02GHXH09J61"," ein":"9NHD0O"," el ":"APOI82JBXM08"," ela":"B8PI0Q"," ell":"7BLA8QD03F1QG06H27I2CM0D"," em ":"BB7"," en ":"7D2AM9D9FFH6GBVHJIM2Q"," er ":"9AWD8MF24HSCM02"," era":"A2YB2TC8VD09F09J6I"," es ":"71L9C0AKI"," est":"7KG803AQJBPDC10D02G09I1KJPIM03"," et ":"7ANG2PH8AM0I"," ett":"F7BGDGH32I0TM3Y"," eu ":"716BLEJ43"," ez":"IAFJ03M05"," ez ":"IE3"," fai":"7D780FC0FJ07"," faz":"B7KM1Y"," fö":"FF1I0R"," för":"FI0"," fø":"H23"," ger":"702809933A03B0JC0ND0ZF0DI03J0OM97"," gj":"F1OH3T"," gjø":"H5G"," gy":"F03I4G"," gå":"F4SH2D"," gö":"F41I05MAO"," gör":"F57I0AM8D"," ha ":"A3PCFSF2XH3CI7B"," hab":"70Z80399WA8PB08I05M0K"," hav":"87ZB0XD02F07G05H0EI0GM1C"," he ":"8C6A2JG40"," heb":"903A02B02DH2"," hee":"DD1"," her":"70287O92HA2FB06D1CF08G22H2ZI08L0DM71"," het":"DQKF0PG1IH0DI0I"," hij":"A1HDFL"," his":"70G86WA0QB0OF0DG0AH0MI25L0MM1D"," hj":"F25H1S"," ho ":"C9Y"," hog":"A04D07INN"," hon":"70H808902A0CB0BD25FC8G03I0KL02"," hun":"80J915A03D1DF1XG03HBCI03"," hv":"H8E"," hva":"H6S"," hvo":"H89"," hä":"910F9RGGY"," hän":"90GF1SGOM"," här":"FA7G03"," i'":"844"," ic":"71E8049BTF02L0JM02"," ich":"9NPL0S"," ih":"94PF0JG2SM1R"," ik":"DCMF05G1FHAKI02M29"," ik ":"DSG"," ikk":"G0KHMB"," il ":"7JVCKY"," in ":"8CU9AMCP2DGHF1CJ0A"," io":"B02C89J03"," io ":"CCM"," is ":"8FTDQJF03H05I9O"," iss":"80490AB8F"," ist":"9IXB1WC07F05G1AI0YJ0EL0CMBN"," it ":"881"," iç":"MBC"," içi":"MBB"," j'":"78W"," j'a":"7BH"," ja ":"90QD0EF0CGBYH0II05L1B"," jag":"903D02FSG"," jak":"G0DH06L8G"," je ":"7QE90EDN0L0L"," jeg":"HSGI0KL2P"," jes":"805A03B03F02LN0"," kel":"903D03G1EIBSL02M0I"," kj":"F02H2C"," kn":"849906D07F0OH09"," kno":"86F904D07"," kom":"92YD43F8KG0KH6UI0XL18M10"," kä":"906F2EG65"," ké":"I6F"," kö":"91CF2BG0AI5TM2K"," l'":"7D8C6R"," l'a":"7ACC3S"," le ":"7O2A71CBKF02I2MJ1E"," les":"7HW80990JA13B03C03D0CG02H1QI4GL03"," ll":"A5B"," lo ":"ABKC6EH06"," los":"80S90CADJD09L03"," lä":"90IF5MG3Y"," mai":"77L808903B85C3YG1PI0AJDX"," me ":"77J874ADPB7JC3TD7MG38"," meg":"C14HB1IQXL02"," mi ":"A8LCB4H06I5SJ0NL59M56"," mig":"70680XA02C17F9TI02L02"," mij":"DD6J0BL02"," mit":"70697SA07B02C02F22GC7H1JI5T"," moe":"B04D9J"," mui":"B8ED05G24"," my":"703838F2WG26H19L2C"," má":"A54B0GI66"," már":"IAZ"," må":"F4UH2G"," mé":"71AA0FB0MI4I"," n'":"79SC03"," na ":"903B6QD0VI0NLEF"," nag":"70J902D05F03IA3L0J"," ne ":"7JPC21G1QI6OJ2ZM8Q"," nek":"H06ID2"," nem":"B13C0HD0NISFJ06M02"," nie":"70292PA0HC1HDN2G03LQT"," no ":"826APLB77C0NG0LL06"," noe":"D0AH7AM09"," non":"718806CSG"," nou":"7DUD09G11J2Q"," nu ":"702D2AF2PJS4"," nã":"BLO"," não":"BOG"," nä":"90DF3PG5K"," nå":"F4NH2C"," oc":"70K807A19B0UC10D03F6ZJ1PL12M02"," och":"A0AD08F8NJ10L0D"," of ":"8CFD2K"," og":"C21D06F03H6LL15"," og ":"HEI"," old":"80XI0QMA0"," ole":"GNML02"," oli":"A02C03D07F0AGFEI02L02"," om ":"D7WF8ZH6JJ0Z"," on ":"73X860GSGL58M0P"," onu":"MD6"," op ":"DB4"," opp":"705807C05D04G18H5B"," os ":"702A0OB8L"," ov":"80QA03B0BC06D1EF06G3KH1N"," pe ":"JF5"," pou":"7G1804B1R"," pow":"808L89"," prz":"LGN"," pue":"A97"," på":"FCSH7H"," på ":"FG6HGP"," q":"76F80H903ABABB7C5I"," qu":"7OD80Z905AQPBSGCIB"," qu'":"7A1"," qua":"73L806906B9SCCM"," que":"7O880L903ARRBSGCFQ"," qui":"78480ZA93B1CC3J"," qué":"A7V"," sch":"7028159FXC0ND6WF0BI03J1HL0C"," se ":"76NAEWBA7C3FF17GC2H1YI0XJA1"," she":"888G02"," si ":"74TA4NB0CC8DH1DJ05"," sie":"7069G7A3MC2KG1QH1FI0FL1C"," się":"LJL"," ska":"802F50G03H5AL0D"," sl":"80PC07D12F2VH1NJ0WM04"," sn":"809D0MF24H2AL04"," som":"72583U90AA0UB0WC0FD0OF7CG02HATJ0E"," son":"7B780K91JA4MB0SCFPF0HI02M4O"," su ":"704A8VC1AM0H"," sun":"80FG0UH07JFLM05"," sz":"IHAL53"," sze":"IGNL0N"," sä":"906F3ZG1V"," så":"F59H2X"," så ":"F4OH6M"," sö":"F0UG0LI0HMAA"," söy":"MAI"," să":"JPO"," să ":"JSD"," te ":"74FA7DB2VC1UDF0F0EG25H08I5SJ7ZL0W"," tha":"8LQC02D02"," the":"8SG90DD0L"," thi":"8CJ"," tie":"70J80490IAA4C05D0NG8XI04"," til":"803FB5G13HHKI09"," to ":"8QRH1NLG5"," tod":"81890DA8UB58G3Y"," tou":"7CB80C902D02G03"," tu ":"7CQ903A42B0XC3MJ2BL1V"," tud":"B23IFT"," tul":"704G9PH09I0D"," tä":"904F1BGDN"," um":"80291PBK5C08G02H05J0NL18M1D"," um ":"938BFJ"," uma":"902BBTC07J09L07M0F"," un ":"7GWAHNCGSJF1"," una":"804907AD8CB2I0CJ0T"," une":"7D5804908G0JJ15"," vad":"C3TD1AF6WI0OJ0C"," vag":"704A04B03C02IDR"," van":"704803A0JB03C3IDIJF0TG37H3AIHT"," ve ":"A0GC05M8F"," vi ":"A0KB0MC2HF9WH97"," vil":"715805A02B03C05F8TG0KH9OI28"," voc":"702A03BJYC0CD02J0A"," voi":"74Z806C3SGBNJ58"," vol":"71480490QA1RB1NC5BD2CF04H05IFJJ07M02"," voo":"B05DAT"," vou":"7H6B2Q"," vr":"71ID2BF02J6G"," vä":"F6CG42"," væ":"H2M"," vær":"H6J"," w ":"LD1"," wa":"7028CH97BA02B03D8OF02G02L1XM02"," was":"8D396KD9LL0H"," wat":"818DA4"," we ":"85MD9QL0B"," wh":"88WB02"," wie":"96ZD2NL86"," wir":"9B3"," wit":"86Q906D0GL05"," wo":"85K92WD26L22"," wy":"L8Z"," y ":"72JA8M"," yap":"MFB"," ye":"70F81KA05F02J04M8R"," you":"7028LO"," za":"908A0DB07C02D1VI0EJ07LELM6A"," ze":"91FB03C0AD5QI0AJ0LL2FM0W"," ze ":"DCCL1J"," zij":"DII"," zu":"989A03C06D0PI03L0C"," zu ":"9D5"," à":"73CB0Y"," à ":"7F0B37"," á":"A08B0EI2W"," ä":"90BFCOG13"," är":"904FOEG05"," är ":"FRS"," å":"F1MH6J"," å ":"F02H94"," ç":"70OM8P"," ço":"MAT"," çok":"M9Q"," è":"C5N"," è ":"CIM"," é":"727A21B4XD05H03I9Z"," é ":"BI9"," él":"70NA5YI2E"," él ":"A8XI0R"," és":"A0BB08I5O"," és ":"B0AICW"," ét":"76PI0I"," ê":"70N"," î":"JBJ"," în":"JQR"," în ":"JMV"," înt":"JCC"," ö":"905F1SI2KM50"," ø":"H18"," ü":"917I13M24"," ş":"J0EM61"," şe":"M8W"," şey":"M8F"," ż":"L5R"," że":"L8U"," że ":"LAM"," ș":"J49"," și":"J8Y"," și ":"JBW"," б":"KFE"," бы":"KFG"," был":"KCH"," в":"KQJ"," в ":"KJ7"," все":"K7D"," вы":"KF9"," вы ":"KD5"," д":"KHK"," до":"KCG"," за":"KFA"," зна":"KAI"," к":"KGJ"," ка":"KCG"," как":"KBV"," ко":"KCE"," м":"KM1"," мен":"KAA"," мн":"KCI"," мне":"KDC"," мо":"KET"," мы ":"K9E"," мэр":"K7K"," н":"KS4"," на":"KOV"," на ":"KGM"," не":"KSG"," не ":"KSG"," о":"KLC"," он":"KIF"," он ":"KE5"," она":"K8T"," п":"KR9"," по":"KSD"," пр":"KMB"," при":"KCM"," про":"KEF"," ра":"KCG"," с":"KQB"," ска":"K8F"," т":"KPP"," так":"K94"," те":"KBU"," теб":"KAT"," то":"KPV"," том":"KQN"," ты":"KEE"," ты ":"KIB"," хо":"KBV"," ч":"KEK"," чт":"KKA"," что":"KOQ"," эт":"KL4"," это":"KNI"," я":"KGE"," я ":"KQH"," 他":"2I4"," 他们":"2F5"," 你":"2IJ"," 你可以":"2R5"," 你知道":"2O9"," 她":"29B"," 如果":"2E7"," 如果你":"2SA"," 我":"2SG"," 我不":"2OU"," 我不想":"2O0"," 我不知":"2SD"," 我们":"2QU"," 我們":"2O2"," 我喜欢":"2P1"," 我在":"2CQ"," 我希望":"2PL"," 我想":"2I9"," 我的":"2IV"," 我知道":"2RE"," 我觉得":"2O9"," 汤":"261"," 汤姆":"2SG"," 汤姆不":"2OI"," 湯姆":"2MC"," 这":"26O","' ":"802902C0CD02I02","'a":"753C19L02M1D","'ai":"79OC02","'ai ":"7B4","'d":"80LM1N","'e":"73DC0GM04","'es":"7AHC0R","'est":"7ENC0E","'h":"70JC0H","'i":"71DC0IM08","'l":"80RM0F","'m":"814","'o":"70MC0B","'r":"80S","'s":"83K905D0C","'s ":"875908D0I","'t":"863M06","'t ":"8BS","'u":"70PC0BM3K","'un ":"73HM8K","'v":"80Q","'è":"C0K","'é":"70X","-a":"B02G05I02J4T","-a ":"B05J9K","-c":"70KB02","-l":"707802B0KJ0H","-v":"70TB02G02I02J03","a'":"809D03M16",aa:"90BDDZGD4I03L02M0R","aa ":"GJO",aan:"D5AGGL","aan ":"DE7GMY",aar:"90CB02D9PG0V","aar ":"90KDMG",aat:"904D2KG38L02M1O",abl:"72E81L902A41F02I0DJ08L03M05",aca:"70B803A1RB1LC16J1OL0IM9H",acc:"71R80JA0LC5GD02F06J0V",ach:"72581596DA0KB46C04D28J07L2M",aci:"70P805A5WB1LC1GI02J1JL1VM05","ado ":"AEOBB8C40",adı:"MB0","ag ":"80491FD2LFR8H1OI0JJ04",agy:"IBH",agyo:"ICV",aid:"71B837A02B02D02G0KI09J04",aik:"G8VI03",air:"76K80SA08B0TC02D04G0NI02M0G",ais:"7HE805902A09B8ZG9TJ02","ais ":"7JNA0BBAO",ait:"7DS80KG2QI09M07","ait ":"7JB80HD05G08I0MM06",akk:"D0GG1NH2KI15M2R",alc:"707802A0HB0BC47J0LL06M07",alı:"MAI","amo ":"A0EB0FCDVL0C",ando:"70E804A97BA4C8CD06I07J05",anno:"70680ECA6F07G0I","ant ":"7AE84R90ED1RF10H2MI0GJ1SL03",any:"82UI1SL1PM0N",anı:"MAY",aq:"707A0UB18",aqu:"710A2RB5A",arı:"MFI",ası:"MAT","ato ":"802A1KB1HCLFG04I02L05",att:"72M80S917C7BD09FJ8G4FH2VI22M1S","att ":"90CFLIH40I26","au ":"76S90PB08D04H02J9V",auf:"70894RF02L04","av ":"F52H4LJ0BM04","ave ":"70C88PA0IB0EC0KD02H0D",aw:"80OD02L5H","ay ":"702852A2KC0IM1L",aya:"708803A0YMBU","az ":"A0JB1KIGQJ0AL1YM4J",aze:"802B5MC02D02I02J06L0LM0Q",azi:"704805903B0BC5OD03I0BJ17L0CM0D",aç:"702B1FM2A",añ:"A1M",ać:"L4M","ać ":"L99",ağ:"M4L",ał:"LBO","ał ":"L8S",aş:"J08M62",aș:"J23",aț:"J20","ban ":"702802A19G02IG8M06","bb ":"F0HH07I4H","ben ":"7029AIA0KC04DCFF0CH0IIBNM83",bia:"803A0LB10C4EG02J08L0Y",bili:"70E809A0IB0FC0SI03J0OL0BMA4",bir:"808A0JB04C0OI04J0MMQH","bir ":"A0MB03MP9",bt:"803919A02D0EF04I02","bu ":"704L05MBU",bí:"A0MI0I",bø:"H0K","c'":"715C0F","ca ":"805A5EB6RC5NI05J60L1MM30",cas:"70Q80BA4VB59C30J30L02M0B",cer:"71H80GA51B3SC3VD02F08I05J4AL0CM0H","ch ":"70583I9MMA02B02C04D1CF6PL76","che ":"73K80396OA35B07CQ7D12J0H",chen:"7078059C9A03D0NF09",cho:"72W80V914A4PB3PD0WF06L41",cht:"9EFD4M","cht ":"9LXD9D","ci ":"72SB0HC6GI03J8EL52M15",cie:"71O809A39B10C0UD04F05J0SL8J",ció:"A59I0DL0G",cke:"70280O912F6U",cl:"70G80YA0QB0GC06D02J0M","co ":"702802A56B5FC60D02L4Q","com ":"BARL03",con:"77S81YAENBDQCC5D0DI02J5FL05","con ":"704A9TC8LI05",cont:"74680TA58B79C49D0KJ2N",cor:"72F80FA2GB3XC55D03J1PL05",cos:"703805A2TB1TCEHI02J0Q",cost:"703808A0WB0YCCHJ0N",cq:"C06",cs:"702802I9B",csa:"I4X",ct:"70R81PA16B03D0EJ1DL02",cu:"70V80QA4KB1NC20D06I05J8FL13M1D","cu ":"706JA2L0PM0H",cz:"LFV",czy:"LCZ","czy ":"L92",câ:"B02J2M",cê:"B4R","cê ":"BFB",cí:"A0FB03I03",có:"A0NB03I02L0B",că:"J7G","că ":"JJZ","d'":"720808C08M03",dad:"803A61B6BF0RM0I",dag:"902C09D12F45H2BI0C",dans:"79QD0CF0DH0HJ0AM0D",das:"999A2HB43C02F0AG09I08L08M0S","das ":"9EVA3QB4TD04F07G05","dat ":"703DKNF06G07I27J2V",dde:"806C03D0MF1JH2KI05M0R","dde ":"C02D0KF1LH5OM02","deg ":"H7UI0L","des ":"7BQ807934A3RB1GD04F1SG0MH09I0CJ0D","det ":"91DFOHG0MHPFI1QM02",dett:"704C4GF1KG0OH5QI1HM09",değ:"M8T",deği:"M9M",did:"70384IA18B0YC03I02M04","die ":"70I8079HZA1LC02D5AJ05",dig:"70680290QA0KB0TC05D1JF7PH2UI24","dig ":"90MD3XF7PH66I5A",dl:"80990BF0DH0II03L1L","dn'":"83U","dn't":"86Y",dos:"706A66B79C0EG09I06L0XM09","dos ":"707A8WB8HI04",dov:"C5FJ09",dt:"90AD0RF02H1EI2Z","dt ":"90BD14H1XI11",duğu:"M85",dz:"D02I04LEG",dzi:"LKJ",dzie:"LFS",dä:"902F0XG2I",då:"F0DH07",dé:"71SA0AF04H02I1D",dì:"C06",dí:"A10B02I0F",dó:"A0NB03I0FL07",dø:"H0O",dü:"903I0FM5O",dı:"MBL","dı ":"MBL","e'":"81MM07",ear:"83I902A0IB08C03J1E","eb ":"906A02C02D34J0CL04M02",ece:"70480FA4BB5TC0SD02F02I03J2LL08MCC",eci:"70P80LA3QB5NC1LD04F0HJ2HL2FM0B",eef:"D3M",eeft:"DB7",eel:"80L903D2OF02G13","een ":"83J905A07C03DRHGBPH05",eer:"808909A0OD4BG04H03","eer ":"80A90AA0VD8WH06",eft:"80ID3OF1HH04J04M03","eft ":"80XDCTH07","ego ":"803A17B0PC0BLFR",egy:"802F02H0KIFW","egy ":"ILW","ein ":"70H9HCD13G30H0AI03",eine:"70R9NGD0IG0VH0BI05",eir:"80Y908B69H02I02",eit:"807952A04B3BD0AG40H08I0A","ej ":"F0NI03L9Z","ek ":"80C902D23F0FH02IDUL3HME0",eke:"804902C02D1XF09G1AH09I7BJ03L04M1D","ele ":"91PA0NBDIC0MD1VG0XH1JI2QJCTL1BM0I",elig:"706806907A11B0HC06D09F05H6BI02J0HL08",ella:"809A7WC70D02F0NG7PI02M02",elle:"7J2808929A08C3ND20F25G4WH5GI6VM0L",enc:"74281LA4OB34C02I0QL0FM1W","ene ":"80390OA5AB02C3MD0JG0SHAUI1XJ0FM0O",enge:"70380590OB03D20F0WG03H72I4MM09",erc:"71I807A1AB13C5JI0FJ1KL0GM0L","ere ":"89L92JA1NB0CCF5D1WF02H7FI0XJ54M1L","ero ":"802AB0B3XCA2G0DL07",ery:"831G03L0TM06",esc:"70H80791NA4HB66C27D0JJ6A",está:"AB8BAN",esz:"I7ML7R","ete ":"80491CA0ZB0TC9QD0EF0MH0DI1CJ0ZM0I","ett ":"90LF8EH45IBZ",ette:"76P81D911C2ZD17F0HG4GHANIA4M0H",että:"GDJ","eu ":"72Z902BOVJ6F",eux:"78N","eux ":"7CV",ey:"82CA08G05M8V","ey ":"83UA0DB02C03M4U",ez:"72F90DA1CB19C0ID21I9UJ2LL23M1N","ez ":"782A2EB39I6OJ1QL1YM1Z",ezt:"I4L",eä:"G0N",eç:"702B0PM1Q",eñ:"A0L",eğ:"M6O",eği:"MEV",eğil:"M8S",eș:"J2L",eșt:"J80",fai:"78Y80AC09J04M02",faz:"B6BM1Q",fd:"D0L",fj:"F04H09","for ":"87KB07F02HE2",fs:"702908D07",fy:"F07H08",få:"F12H0R",fè:"702C04",fö:"F6RI0K",för:"FG8M02","för ":"FCB",fø:"H1K",fü:"91XI0E",gee:"D25","ger ":"72Y812921A09B04C0FD26F4HH9KI08J05M02",ggi:"802C4J",ght:"84F","ght ":"702871",gio:"706805902A0CB0FC5ZF02H03J03",gj:"F0MH2YI0R",gje:"H1MI05",gjø:"H2B",gjør:"H5Q",gs:"80I90WD0DF0OH11I0T",gt:"705921D0NF25H0RI18","gt ":"705926D0UF5SH0S",gv:"H08I0K",gy:"804F02G02H0EIMM","gy ":"805IMK",gye:"I6I",gyo:"I62",gå:"F23H1M",gö:"F1GI0CM47",gör:"F3YI05M7E",gü:"902A03I0AM3I",hab:"70Z80294BA5UB07I02M0M",hac:"707903A53F05L02","han ":"81RA13D02FFHG3AHF6","har ":"A0FB1NFG4HIEI05J04M06","hat ":"70L8MX986D05G0FI0VM0E",hav:"84JB1BD02F06G06H07I06M16",have:"87PB0KD05F06H07I03",hd:"802903G1WM02",heb:"903A02D53","heb ":"DB7",hee:"807C0BD3ZG0O",heef:"DAM","her ":"71R89B93HB0XH2NM4Y",here:"87T90CA03B0CC08D03G04","het ":"702DQGF1BG09H2HI3C",hey:"83MM0D",hij:"A0YD4Q","hij ":"DFK","his ":"7038CMJ0QM02",hj:"F0SG09H15",hje:"G08H1Q",hl:"80292QG05L03M0A",hm:"91CG0NL05M04","ho ":"819A3LB96C71G03L04",hog:"A05D02IBW",hogy:"IOC","hon ":"705928F9PG0GI19",hou:"708843B0UD1EG05",hr:"70480N965D0FG02L05M07","hr ":"94G",hre:"80P93ID07G06M04",ht:"8279A9D32G2BM15","ht ":"83W9BLD2K","hun ":"D1DG0MHA3",hv:"G08H5IM0B",hva:"G08H2QM08","hva ":"G06H6R",hve:"G02H1RM0L",hvo:"H3D",hvor:"H89",há:"A02B0MI2Z",hã:"B0F",hä:"910F3NG5S",hän:"90AF1EGHN","hän ":"GKG",häne:"GA2",här:"F7RG02","här ":"F9X",hå:"F0XH0F",hé:"70EA02C0XI0W",hö:"914F1JG03I09",hø:"H0X","i'":"827M0D",iac:"A03C4II02L0B",iam:"702804A08B18C9YG04I0BJ0GL0S",iamo:"A03B02CCY",iał:"L8P","ich ":"70380X9SGA02C04D2AL2Q",icht:"9LFD2V",ici:"72X80GA3MB20C4DD05F08I0CJ9ZL0JM0P","ido ":"A84B4WC0OL02",iedz:"L7I",iene:"90BA7WB02C0WD08G0MH05L0Z","iet ":"702807905DLBF0DG02H0PL03",igh:"70282ZC02D05F0SH11J02",igt:"70490KD07F53","igt ":"70390YD0RF6P",iin:"G9UJ0K","iin ":"GC9","ij ":"D81L0L",ijk:"D3I",ijn:"D87","ijn ":"DN9",ikk:"D07G6PHCOI04M0R",ikke:"D0RG0YHNRI06",inde:"703807933A07B07C03D3JF0CH0CI9EJ0YM5U",inge:"70780892UA06B03C0CD3AF60H86I09J0Q",inh:"903B93G07",inha:"702904B7L","ini ":"70FC20G1IJ0VMCC",inul:"GBJJ0Q",inun:"90GA02B02C02GAYJ0O",inä:"GBK","inä ":"GI2",iq:"70PA04B07","ire ":"7E380MA0CB05CFCD05G0AH0FI2AJ1DM07",isk:"803903D04F3JG2JH1WI0QL0SM09",iss:"74080M91ABAGC1UD0JF1VG6UH0TI1BM16",isso:"70PB99G06","ist ":"80T9K6D26F0FH1BJ0WL0HM06",ith:"70283XB02F02G02L02M03","ito ":"803A2PBA0C68G08","itt ":"90DF4QH6NI5U",ità:"C4G",itä:"907GDT","itä ":"GGE",iy:"MDH",iyo:"MIL",iyor:"MKC","iz ":"702A0OB1VM9Q",ià:"C08",iä:"G14",iç:"B0BM6B",içi:"MAF",için:"MBE",iè:"70N",ié:"70CA0PI16",ië:"D0F",iñ:"A0G",iò:"C0A",ió:"A3DI0KL0H","ió ":"A4EI0A",ión:"A6G","ión ":"A9N",iù:"C0W",ię:"LBV","ię ":"LH5",iğ:"M3S",iği:"M94",ił:"L4K",iş:"J02M3V","j'":"71U","j'a":"774","j'ai":"79W",jag:"FQD","jag ":"FSG",jd:"D14F06I0OL0L",jeg:"HHRI0DL2S","jeg ":"HSG",jest:"G0MLM6",jf:"D0GI02",jg:"D07L02",jk:"D2BF05I02L05","jk ":"D2B",jn:"D5II0BL0I","jn ":"D7O","jo ":"A43B0UG15H09",js:"D0BI0AL0Y",jt:"D08I1E",jv:"D0A",já:"B0LI3H",jä:"F1LG1I",jæ:"H08",jø:"H2I",jør:"H2P",kaa:"D0JGB7","kaa ":"G9I",kai:"G6LI0EM02","kan ":"D67FA6G1JH8PI0FM0M",kell:"903G2CIB9","ker ":"80A90PC02D2ZF7KHCUI05M09","ki ":"703A03B03C02G4MH02I5ZL5GM65",kj:"D04F05H2NI03",kje:"D05H2A",kjø:"H1J","kk ":"H29",kke:"D14G0YHEJI0PM07","kke ":"D06G02HNM",kla:"90GD0GF26G06H1TI04L0JM5A",kn:"825905D06F0TH0DI0TL0XM08",kno:"83L902D02L07M02",know:"86E",kom:"91ZD1MF6ZG0VH31I0ML17M0V",komm:"94HD03F6VG09H56I07",kor:"905D07F2CG1HH0FI4RL0KM1Q",ksi:"GAZH04L1LM14","ksi ":"GDQM05",kt:"91CD1YF2ZG05H2SI0UL2OM5D","kt ":"912D29F2SH17L0S",kte:"90ID0MF2LH1TI0CL03M4S",kv:"F0PH0II04",kw:"902D0HL0B",kä:"906F15G43",ké:"I52",kö:"90VF0ZG17I44M0Y",kı:"M4K","l'":"72VC2GM04","l'a":"76DC3D","lar ":"80F90DA2UB2WD08F5NH19J0JMAE",ları:"MBV",lc:"70280290EA08B03C14I0LJ0AL06M08",ldi:"807908A02C12D0AF1AH1MI04M5D",ldu:"902J06M9W",leri:"702905C02F02G03H06M97",lh:"702902B32F02G02H03I0Z",lho:"B5XI03","lig ":"90LD0KF2MH9JI0Q",lij:"D3EG0UI02J03L02",lijk:"D9Y",lik:"82U902D04F10G0TH2KI0IL0GM3S",lj:"D02F16G15H07I2A","lle ":"7IR931A0HC53D1AF5MGGRH9VM04",ller:"73080890YA08C0BD0MF3KG09H5OI05M0X",llä:"F03G91","llä ":"GDN",lma:"702A0AB0CC04D02F02G36I18J05MAM","los ":"70480490MAG6B1ID05G0ZI0AJ0JL02",lr:"807A02F06I0E","ls ":"74S80V92BD2BF0LH02",lui:"73BA04B06C4ED0FG0KJ8J","lui ":"74PB02C6WD03G04JD9",lw:"80BD02L09",lá:"A0AB0EI6D",lä:"90QF2SG4R","lä ":"F02GAF",lå:"F1FH0G",læ:"H0T",lé:"70XA0EB03I2X",lì:"C06",lí:"A0KB0EI0F",lö:"909F0XG0II0P",lø:"H0X",lă:"J26",lı:"M7Q","m'":"70N80CC02L02M4R","m'u":"M8S","m'un":"M8B",maa:"D2VG78M06","mai ":"702C40I0EJEE",mais:"782B8IG1H","mak ":"D02H04I02L03M8H",md:"903D0EF0AH02M20","med ":"80YF8WHB7I05",meg:"C0PH4LIEJL07","meg ":"HAXICL",mek:"G0NH03I0JL09M8Z","mek ":"I0CL0BM8F","mer ":"71C80G93SA1FB0YD23F6RH77I07L06M02",meu:"70GB59J2U",mig:"70580JA1WB2FC17D04F7FI02J03L03","mig ":"F9TI02",mij:"D3RJ06L03",mijn:"DA7",mind:"80J906B08D0DF0AH0CIE3M07",minä:"GB9","mit ":"708807979F0AG03ICJJ1M",mitä:"G9U",ml:"906D02F0HH0AI0JL05M1R",mma:"70F804902C0TD02F4UG1MH05I0H",mme:"77Z80E93PC0WD0HF58G7KH5KI0AM0A","mme ":"76190PC02D05F0CGAWH3U","mo ":"A6FB71CC8G0NL0K",moe:"B04D2V",mond:"72480F906C0OD0AIAYJ07","mos ":"AB3BAVI0HJ0Q",mt:"90QD0EF0RH0UI07J05L06",mui:"B6ZD02G19",muit:"B8EG09","my ":"835L7R",má:"A23B09I5K",már:"B03I4Q","már ":"I98",más:"A5TB0AI3O","más ":"A8QB0AI40",mã:"B0P",mä:"90DF0QG3S",må:"F1WH1W","må ":"F08H1N",mé:"70MA08B08I44",mí:"A0HB05I0H",mø:"H0J",mă:"J2Y",mı:"M5R","n'":"722866C0CM14","n't":"8BS","n't ":"8JF",naa:"D2MG1V",nagy:"IAD","nak ":"IGBL08M04",nb:"90BD0AF08H06I0OM02","nde ":"743931A3VB4IC1XD3MF69H3GJ4FM4K","ndo ":"804AE4BFICBZ",nek:"F02G0FH05IATL0FM0I","nek ":"ID8L0LM08",neke:"G03I9R","nem ":"93MB14ISGJ0AL0WM0F","nen ":"9DJA1AD8VF3KGKGH5FI0JM09",ngen:"70794GA06B04C07D4ZF60G03H78",nger:"72I812917C0PD1LF1RH6XI0QJ0B",nha:"802907B8LF02G0VI02","nha ":"B7WG0S",nho:"904B7KD02G0BI03",nich:"7029HRC02D02L0C","nie ":"70J91LC02D09F02I0ZJ17LSG",niet:"A03DLNL02","nin ":"F02G26M9Y",nlar:"M9D","nn ":"94SF0PH3EI06L02","nno ":"CA8L05",noe:"D0EH2ZM08",non:"71G804COCF02G0RI03","non ":"71ICSGG0LI07","nos ":"70UA7LB5TI14J0AL02",nou:"79980FB0SD02G0NJ1O",nous:"7CNG0U",now:"84JL2D","now ":"86W",nq:"70AA06B07C06",nsk:"F3EG2CH30","nte ":"73J92AAERBERCEGD0MFKMH2EI0OJ3S","nu ":"70YB02D0MF29G05JMAL0XMG5",nul:"708C0UG6OI1GJ48M03",null:"705902C1DGB4I03",nun:"90QA1LB28C08G6LI0EJ0YM94","nun ":"90AGAZM89","nut ":"D02F04GB6J0UL0BM02",nyt:"80MF08G5XH0AI0T","nyt ":"GA6I1M",nz:"91JA0FB02C1ND0CI0VJ09M08",ná:"B05I3E",nál:"I49",nã:"B64",não:"BLP","não ":"BOH",nä:"90BF1NG61","nä ":"GDF",nå:"F1PH1N",någ:"F4E",næ:"H09",nç:"707B0SM0N",né:"70UA07B02I3W",nó:"A08B0QI04L0B",nø:"H0I",nă:"J2E",nı:"M9X","nı ":"MBV","o'":"804C0AD05M05",oar:"804B07F04J9D",och:"714931A28B05C0AD0ZF6HJ0UL38","och ":"959D11F8NL03",ocê:"BH6","ocê ":"BHX",odo:"A4HB3GC0QG18I0GL1E","oe ":"802A02B03C02D1NG02H1P",oen:"B0FD1WF04G05H1L",oet:"A02B03C02D2FG08J02L02","of ":"876904B02D10",ogy:"803IC3","ogy ":"805INQ","oi ":"773B46C7MD07G5MJ5UL0D",oin:"72X832A03B02C03G5IJ05L03",oir:"75XG12",ois:"75N805A06B40C02G6MJ04L03",oit:"73EB1JD0TG7BJ03",oj:"A0JB0IF08G0RI04L4BM04",oldu:"I02MAA","ole ":"71I80I903A04B04C48D02GB2H0EL0P","oli ":"705C0VGAPI02J05L0L","olt ":"903F06H0AIBO","om'":"80OC07G02L04MBW","om'u":"M9Y","omi ":"B05C05F04GAUI5IL02M02",omm:"77880D924C0HD09F5NG1AH2UI0E",omme:"7AP80693JC0LD0HF5BG0FH6P","on'":"83XM23","on't":"86Y","ono ":"A0OB0GCJ3G0EL0E","ons ":"7BI81I902B09D2QF02","ont ":"7BI809902D0UF0JI13J06",oor:"80JD5G","oor ":"80VDB7",opp:"70980E902C1OD06F1OG1NH2TI02","oro ":"A0HB0IC8EG04L0D",orum:"902J05ME3","osa ":"703A24B18C8DG0CI08L04",oss:"71080K90CB4YC4SD04F1SG2WH1GI1L","ost ":"81Q905D0KF0DH0EI5IJBJL06M02",ostr:"A0JB0LCGKF03J0UL15","ott ":"90DF0UH08ICP","ou ":"71H8AJBHKD23J1E",oul:"72N84VG1AJ0O",ould:"88L","our ":"7CD85E",ous:"7K381UB04G0S","ous ":"7QP81LG07",out:"76K840B20D0BF02G0N","out ":"76186GD0P",ouv:"767B1AG03","ow ":"86KB02",owi:"806L8I",oy:"70G80EA1VM1K","oy ":"80CA5LM08",oz:"903A09B0DC0AD04I4BJ0BL2JM09","pas ":"7NKA0DB0ED0AF0OG06",pg:"D07H03","por ":"ACDB9GF04I02M0E",pou:"7AH803B1LG02",pour:"7DN803",powi:"L7U",prz:"LD2",prze:"LAN",przy:"L8S",pue:"A6S",pued:"A7I",py:"809G10L0NM02",pä:"908F03G2D",på:"F4UH4S","på ":"FCIH7D",pø:"H0F",pă:"J23","qu'":"77B",qua:"72G808903B8NC8V",que:"7LK80K904ANZBSDCB0","que ":"7OQ806ARCBRKC0W",quer:"70V903A28B88",ques:"73480LA0EB0DCBK",qui:"75S80PA81B5UC2J",qué:"70PA5C","qué ":"70RA7Y","r'":"804M04",rai:"79P810902A06B0XC1GG0KI04J08","rea ":"806A0GB04C06D02F02G02JC1",rec:"71780R91DA5CB72C0ZD0GF0GI03J4NL08M1H",rer:"71X80290YA0LB0QC0XD02F0JH2HJ0OM09","res ":"77K80K90SA8NB49D0GH18I0ZJ04L0AM02",rij:"B02D22J10",rj:"D02F0LG1JI10M03",rui:"70N804A0GB0EC7MD0SG03J0I",ruir:"704A05B04CBL","rum ":"926D04F0MJ0BL03MDZ",rw:"80390KD0EL10",rz:"912A06C05D0BI0MJ0ALDCM03",rze:"90LC03D03I0GLDD",rzy:"LAE",rà:"C0V",rá:"A1GB17I48",rä:"90MF2IG0U",rå:"F1VH0X",rè:"70U",ré:"71YA0UB04I1F",rí:"A2EB08I0C",ría:"A6MB0D","ría ":"A7S",rò:"C0U",ró:"A0NB0AI21L29",rö:"909F19G02I0T",rø:"H1H",rü:"918I13M2J",ră:"J4A","ră ":"J82",rı:"M7Z","s'":"70W802C05M04","s-":"71BB02I02J1E",saa:"B02G63M1K","sak ":"F0AI96M06",sco:"709808A0XB2WC4FD03J0VL02",sd:"902A08B03D06F04H05I0H",seg:"A1TB2UC2PF04H1XI1D",sei:"70Q947A09B2RC2HG1YH03I06J07","ser ":"73P80593KA2LB3FD05F2PH60I02L03M07",she:"855903D02F02G02I04","she ":"86Z",sic:"70380H93MA0RB0WC20J0KL02M02","sie ":"70E9FHC02D0KJ08L11","sin ":"70I803904A21F2TG9TH2PM5X",sinu:"GCBJ05",się:"LF3","się ":"LJI",sj:"D0EF0WH1JL06","sk ":"80HF1EH2OL04M02","ska ":"F8TG1UI0QL0J",ske:"80O902C02D03F18G2YH4SI09M0C",skj:"F0CH1O","sn'":"83H",sna:"802D04F1DH1QI0NL04M02","so ":"81B91ZA65BDOCBNG0IL04","som ":"B04F79HATI0R",sono:"B07CFS","ss ":"81Y94GF2LH1XI0F","ssa ":"709802B3KC1ZF0XGL5I0C",sse:"76S80V94CB7NC63D0VF0SG06H1RI0FM14","sse ":"74H91EB79C3YD06F02H1NI04","sso ":"BC7C7N",ssz:"I4N",ssä:"F02G6O","ssä ":"GAI","sti ":"B02C2UGA5I05M06","sto ":"905A4RB4RCCZF03G0FH0DL1C",stá:"A7LB8XI0A","stá ":"A81BA5",stä:"90EF2NG9I","stä ":"GB6","su ":"704A5WC0TG0DL12M0W",sunt:"A0AB09C04G08JEJ",sv:"903C0AD03F18G0BH13I04M02",sw:"80E906D03L1G",sz:"906INDLFB","sz ":"I7GL8Z",sza:"I4KL2O",sze:"903ID4L4V",szer:"IFSL06",szo:"I4BL0K",szt:"I4HL0Q",szé:"I4E",sá:"A03B07I2S",sã:"B10",sä:"907F1RG3S","sä ":"G8R",så:"F24H24","så ":"F41H35",sé:"70XA0KB05I3U",ség:"I4N",sì:"C0K",sí:"A0IB07I0Q",sö:"F0WG06I0NM42",söy:"M9A",söyl:"MAI",sø:"H0T",să:"JA3","să ":"JP5",sı:"M84",sın:"M92","t'":"70E81F902C03M02",taa:"904D1DGBNM02","taa ":"GD1",tai:"76K80KB0DC0PD02G4VI0CJ0N","tam ":"B0UIECJ09L1TM0W",tb:"802905A02D08F06H05I0QJ02M04",tc:"80FD02F02I05J04L06","ted ":"86VA1DH0FI39","tem ":"805909B6QD06IDHJ2NL51M02","tet ":"92XF28G09H5WI2CL03",tg:"907D09F02H02","th ":"70284YA02B02L02M02",tha:"7028DL904D02G06I0TM02",that:"8KNI1A","the ":"7028QB",ther:"70288H903D02",they:"86H",thi:"703891903M02",thin:"89L905",this:"86S",tid:"702A19B1GC07F3EH22J02M0A",tien:"71K807904A87C0DD0VF02G1HJ06","til ":"70680G902A0BB0DD08F04HFHJ07M04",till:"70981L907A0DD03FBDG0AH1A",tj:"D0IF0FH0BI0U",tk:"903D03F03G2YH02I0WL2BM0A",toi:"72GC0CG5SL04","tom'":"817G03L05MDE",tomi:"C02F03GIAI7HL04",tos:"704903A41B4RC0ZG2FI1UJ07L07M05",tou:"78F807B5UG06","tre ":"7EE802A17B12C3KF1VH24I0NJ3HM06",treb:"903C0NJC8",trui:"70GA09B08CBPD05J0B","ts ":"75S83C913D1RF16H0EI09","tt ":"90PFO9H70IEH",tta:"70E805906C4WF5UGDTH04I3EM0L","tte ":"76080294LC2ZD1BF0UG3BH96I4BM0G",tti:"70780J902C55D06F0RG6YH0HI05M72",tto:"707804CB1F0AG1UH04I03","tto ":"CEAF02G0B",ttä:"902GCR","ttä ":"GDI","tu ":"7BBA2PB0RC2AG1QJ1EL2HM1M",tw:"80E90YD0SL2N",tz:"92DD05",tà:"C1H","tà ":"C5K",tá:"A2IB2DI5A","tá ":"A5CB8H",tã:"B11",tä:"90IF1GGF4","tä ":"GNT",täm:"F0IG61",tämä:"G9W",tää:"GA5","tää ":"G9V",tå:"F0XH0U",té:"721A0EB0EI4Z","té ":"773A0UB19",tò:"C05",tó:"A0QB0AI2HL1I",tö:"905F0CG0WI38M03",tø:"H0F",tă:"J68","tă ":"JG5",tı:"M71","u'":"71I80O",ual:"70480M902A18B2AC4TG02J0FL05",uan:"71SA2RB57C3AG1PH05M03",uch:"71481793NA4AD0AL1F",ued:"804A6CB04J02",uer:"71M90QA5RB75C0AF02H05",ues:"72N80J904A3DB0FC7IG04H02",uest:"71180NA4BB09CBJG02",ugh:"82V902J05",uh:"70290LG1QH02I0CM0J","ui ":"786A0CB3SC6WD02G2LJBB",uie:"70H803A5PB03J59",uir:"70M804A0MB0OC7PG02J03",uire:"70S805B02CBP",uis:"76N803A0LB0XC07D1FG21",uit:"72L80KA0IB75C0BD2MG0LJ3E",uito:"A06B7BC0AJ06",uld:"84T90DB07D0BF07M1F",ull:"70580F902A09C1KD1NF48G93H1QI09M1D","uma ":"A06BD8C02G0EI02J09M0H",una:"703805903AA9B07C7TG2CI06J2TM1P","una ":"AE3B04CBLG1DJ3EM1L","und ":"81R9C1F1DH0SJ09",une:"7AJ805908A0AB02C0LG0ZH03J4QL05","une ":"7FQ804904C0EJ3S",unk:"80690EF0DG0OH07I58L0IM02","unk ":"808I9F",unn:"807902C07D0NF14G33H27","unt ":"80A902D1HF0DJD4",unu:"G1QJ1CMEA","unu ":"G02J06MC2",uo:"70IA03B03C3JG58L02",utt:"70380690HC4WF0IG78H17I02M0K",uu:"D0RG5F",uw:"D1ZL0Q","ux ":"7A6",uy:"70280CA12M3V",uz:"903A07B09C04D07I04J10L0GM2X",uá:"A0MI02",ué:"70DA20B0H","ué ":"715A5F",uí:"A0OB06",uò:"C0C",uğ:"M3G",uğu:"M8G","v'":"C04",vad:"A0DB0IC2ED0DF5DI0CJ0BM05","vad ":"F6YI03",vag:"706A03B08C08F04I5VJ02",vagy:"IDS",vai:"76E802A03B2QC2BG67I03","van ":"A0MDGZF06G4GIGPJ05M05","var ":"A0KB0RFCEHAII06M72","vat ":"D06F04GCVI05J0VM05",vd:"F06H09M0L","ver ":"72084M904A29B35C0LD4NF4ZH5UI05J05M12","vet ":"F3TG05H5JI2CM0L","vil ":"804A06B02H7M",vill:"717805A0AC05F68G0NH2HI0F",vl:"D0FF0BH03M0K",vn:"F03H0GI04","vo ":"A2HB2SC51G03",voc:"705A0EBH9C0DD02J0D",você:"BJX",voi:"75I806C2DG7OJ50",volt:"B1KC21D02IDFJ08",voo:"B04D34G02",voor:"DB7",vor:"706807921A1MB23C4UD0BF0JH3IJ4EM04",vou:"7E5804B2LD02",vous:"7JG805",vr:"712B0MC0PD1PF04H02I02J1TM0I",vv:"C0GI03",vá:"B07I3Y",vä:"F3EG46",vå:"F15H0L",væ:"H1T",vær:"H2W",vé:"70KA03B02I2Z",waa:"D2P",waar:"D93",wan:"83890OD0ML2P",war:"80M93ZC02D0QL1A",was:"87K93ND2PL0G","was ":"8BP97SD9DL0A",wat:"80OD2TL08","wat ":"D93L03",wd:"D06L18","we ":"835D30L1J",wee:"70480QC04D2KJ03L04",wh:"84L",wha:"83GB02",wie:"937D0PLE2",wil:"821914D23L0O",wir:"94UL02",wit:"83S904D06L0B",with:"86O",wn:"80OL1S",wo:"83292CD24L5L",wr:"80EL0T",ws:"80FD03L33",wy:"L6E",xa:"704805A05B0KD02F05J05",xc:"704805A04B03J03",xp:"70680FA0AB09J0A",xt:"70380D902A0CB06F05J04","y'":"80HM2E",yap:"I05MDO",yb:"809I0GL1FM0E",yc:"803F2FL3XM02",yck:"F6T",ycke:"F6Q","ye ":"703804A05H1LI0SM7Z",yg:"F0IH0FI04L14M0D",yh:"F02G17I09",yi:"80KG0NI2CM64","yi ":"G16I0UM9T",yk:"F06G1CH14I09L1ZM09",yle:"707804G0LI0DL0CMB8",ym:"702807902F07G12H05I0DL53M0D",yor:"702802A0OB02C02F03G03I0MJ03MRC","yor ":"A0JMH0",yoru:"MF8",you:"7028DI","you ":"8HL",yt:"80JF0FG41H0QI16L22","yt ":"F02G6BH03I0XL0R",yv:"F02G1DH04I0UM07",yy:"G1C",yö:"G1VI0AM06",yı:"M4L",ył:"L4H","z-":"70S","ze ":"70780A90QB0AC0OD4ZI0YJ1FL6VM2C",zer:"80290BB5YC09D03I6YJ08L11M1C",zere:"B02IAGM0A",zie:"90RC19D1PJ0DLCA",zij:"D5P",zijn:"DGG",zio:"B02C7OL0E",zion:"CALL08",zt:"916I8EL0J","zt ":"918I70",zu:"964A03B02C02D0II0UJ0SL22M0T","zu ":"95XL0KM0D",zw:"90RD0EL1Z",zy:"802LEPM06","zy ":"804LA5",zá:"A02I3U",zé:"I3I",ß:"90P",ße:"910",à:"71SB0EC13","à ":"73TB0QC2N",á:"A2OB2SIDM","á ":"A2NB46I11",áb:"A05B03I2U",ág:"A03B0AI37",ál:"A09B07I9K",án:"A1AI66",ár:"A08B0OI8U","ár ":"I55",ás:"A2HB0EI5X","ás ":"A7NB16I3G",át:"A06B06I77","át ":"I6B",â:"706B04J34M0B",ân:"B09J3Z",ã:"B4L","ã ":"B0I",ão:"BA3","ão ":"BS0",ä:"91MFDYGMG","ä ":"F02GKQ",äg:"907F1J",äh:"90SG1S",äi:"G2M",äk:"F0OG1G",äl:"90IF3OG2M",äm:"905F0ZG2C",ämä:"G6Z",än:"90ZF5FGBF","än ":"F2NGNO",änd:"90PF3P",äne:"903G67",är:"90QFFXG1K","är ":"FRUG03",äs:"90BF1AG2E",ät:"90YF2FG2Y",ätt:"90MF4NG23",äv:"F0BG1F",äy:"G20",ää:"G7Z","ää ":"GB6",ään:"GBF","ään ":"GGF",å:"F8XH5K","å ":"F7PHDU",åd:"F0KH0G",åg:"F2T",ågo:"F41",åk:"F0SH0I",ål:"F17H0J",ån:"F2PH0I",ång:"F43",åp:"F02H0F",år:"F33H3Q","år ":"F69H4L",ås:"F15H05",åt:"F1MH0Z",æ:"H0V",ær:"H3E",ære:"H2U",ç:"70IB1HM61","ç ":"M3F",ça:"70WB1GM3B",çi:"M5A",çin:"MAH","çin ":"MAR",ço:"706B0OM4H",çok:"M95","çok ":"MA9",çã:"B18",è:"71AC2O","è ":"C6A",èr:"719",ère:"764",ès:"70R","é ":"74LA3LB5BC0ZD02F04I0W",éc:"718A03B04I02",ée:"71I","ée ":"75J",ég:"70BI6T","ég ":"I55",ék:"I32",él:"70IA1WI6U","él ":"A5YI3F",ém:"70AA02B0SI14",én:"70AA0RD05H03I61",ép:"70PI2H",ér:"714A08B0AI81",ért:"I5V",és:"711A13B07I7V","és ":"72RA34B0MI6O",ét:"728A03B03I45",ê:"70WB2M","ê ":"B43",ên:"B0I",ês:"B1J","ês ":"B6H",êt:"71I",ë:"D05","ë ":"D0B",ì:"C0F","ì ":"C10",í:"A2XB0XI2F","í ":"A1ZB03",ía:"A4PB05","ía ":"ABLB02",íc:"A0DB0F",ít:"A05B04I3K",î:"707J50",în:"703J9M","în ":"JFS",ñ:"A0X",ña:"A13",ño:"A1H",ò:"C0T","ò ":"C1Z",ó:"A2SB0YI3TL4P","ó ":"A41B0FI3D",ól:"A0AB04I3BL0G","ól ":"I4SL0C",óm:"A0JI07",ón:"A33I0I","ón ":"A8FI07",ós:"A03B0VI0OL08",ô:"707B06",õ:"B07",õe:"B0I",ö:"915F7KG2BI4TM3Z","ö ":"F06G1A",ön:"915F0OG0LI3MM2G",ör:"90WF98G08I2SM3B","ör ":"903FBII0EM09",örs:"902F3R",öv:"F1QG02I12M04",öve:"F47I11",öy:"G0IM43",öyl:"MAC",öyle:"MAX",ø:"H33",ød:"H0Z",øk:"H0S",øl:"H0S",øm:"H0G",øn:"H11",øp:"H0P",ør:"H4D","ør ":"H27",øre:"H2H",øs:"H0R",øt:"H0Q",øv:"H0M",øy:"H12",ù:"706C0E","ù ":"70DC0X",ú:"A0KB0CI1I",ún:"A0KB05I04",û:"706",ü:"924I2XM80",üb:"91HM03",üc:"915M0C",ül:"908I4UM18",ün:"90LI2GM7P","ünk ":"I97",ür:"926I0CM3B",ă:"JGA","ă ":"JN9",ăr:"J36",ăt:"J1W",ą:"L5Z","ą ":"L82",ć:"L55","ć ":"LC4",ę:"LAM","ę ":"LHC",ğ:"M63",ği:"M95",ğin:"M8G",ğu:"M3T",ğı:"M5K",ı:"MIA","ı ":"MJR",ık:"M4Q",ıl:"M4N",ım:"M8D","ım ":"MEZ",ın:"MFG","ın ":"MFK",ınd:"M9C",ında:"MA4",ını:"MD9","ını ":"MB3",ır:"M6S",ıy:"M5K",ıyo:"MAH",ıyor:"MBU",ız:"M4Y",ış:"M42",ł:"LD6","ł ":"L9M",ła:"L7F",łe:"L66",łem:"L8V","łem ":"LCC",ło:"L5O",ń:"L11",ő:"I3H","ő ":"I36",œ:"704",ś:"L5Z","ś ":"L4S",ş:"J0HM73",şa:"J03M3L",şe:"J03M4F",şı:"M3O",ţ:"J0J",ű:"I0Q",ź:"L0Q",ż:"L6C",że:"L6F","że ":"L97",ș:"J4G",și:"J3U","și ":"J9Z",șt:"J4E",ști:"JAL",ț:"J47",ți:"J78","ți ":"JDV","̇":"M0I",а:"KPL","а ":"KQP","ает ":"K8F",ал:"KFF","ал ":"KEI",ать:"KHM","ать ":"KJY",б:"K8X",в:"KGE",во:"KDH",г:"K7J","гда ":"K8F",го:"KFL","го ":"KIF",гово:"K7T",д:"KDR","да ":"KBW",де:"KEC",дел:"KBG",дела:"KAA",е:"KQR","е ":"KSG","ебе ":"K7E",его:"KD0","его ":"KEP","ему ":"K8J",ен:"KFZ","еня ":"K9Q",ет:"KEY","ет ":"KH9","ешь ":"K8B",ж:"K55",з:"K7K",и:"KLO","и ":"KOL",ит:"KEI",ить:"KBZ","ить ":"KDO",й:"K5A","й ":"KFB",к:"KCN",ка:"KDZ",каза:"K8T","как ":"K8Q",ко:"KFV",л:"KH7","л ":"KFG","ла ":"KBG",ли:"KD3","ли ":"KFU",м:"KGY","м ":"KLY",меня:"KA4","мне ":"KD2","му ":"KB9",мэри:"K7J",н:"KNA",на:"KM8","на ":"KL5",не:"KO8","не ":"KSF",ни:"KGM",но:"KGF","но ":"KH9",о:"KSG","о ":"KSG",ов:"KD4",овор:"K7V",огда:"K7L","ого ":"KC5","ой ":"KE1",ом:"KKG","ом ":"KOQ",он:"KEA","он ":"KC6","она ":"K9G",ост:"KD5",п:"KBR",по:"KKF",пр:"KE6",про:"KDL",р:"KG0",ра:"KHG",ро:"KEM",с:"KJD",сказ:"K7O",ст:"KJO","сть ":"K7P","сь ":"KC0","ся ":"KIV",т:"KPL","т ":"KHV",та:"KD7",те:"KG3","те ":"KCM",то:"KSA","то ":"KRY",том:"KOJ","том ":"KO7","тся ":"KC4","ты ":"KFY",ть:"KIB","ть ":"KR5",у:"KCT","у ":"KIJ",ф:"K0T",х:"K3O",ц:"K1K",ч:"K84",что:"KKH","что ":"KLT",ш:"K4M",щ:"K19",ъ:"K05",ы:"K9R","ы ":"KJX",ь:"KAJ","ь ":"KP3","ься ":"K8D",э:"K3E","эри ":"K7I",это:"KJ4","это ":"KIC",ю:"K3E",я:"KBD","я ":"KRD",ё:"K2N","​":"207",一:"2H5",不:"2I1",不知道:"2DC",了:"2N1","了 ":"2I3",人:"2AJ","什么 ":"2E0",什么时候:"2Q1",他:"2JJ",你:"2K8","吗 ":"275","嗎 ":"25T",在:"2FQ",她:"29M","工作 ":"2C6",我:"2SG",我不知道:"2SG",我们:"27C",我的:"26P",是:"2JR",有:"2E7",汤姆:"27V",的:"2S3","的 ":"29E","的时候 ":"2RL",要:"28S"},uniques:{" aan":"d"," aic":"j"," aik":"g"," aiu":"c"," ao ":"b"," aos":"b"," as-":7," até":"b"," auf":9," auz":"j"," aí":"b"," aú":"a"," cee":"j"," chc":"l"," cs":"i"," ctr":"k"," cu ":"j"," cua":"a"," cóm":"a"," daa":"d"," dl":"l"," dzi":"l"," där":"f"," dår":"h"," dés":7," día":"a"," dón":"a"," död":"f"," ea ":"j"," ear":8," eat":8," een":"d"," eft":"f"," elä":"g"," em ":"b"," epl":"h"," etm":"m"," etw":9," ez ":"i"," ezt":"i"," fez":"b"," fi ":"j"," fiq":"b"," fje":"h"," gaa":"d"," gi ":"h"," gic":"f"," gik":"h"," gje":"h"," gân":"j"," göz":"m"," hje":"h"," hoz":"i"," htt":"k"," hv":"h"," há ":"b"," hâl":"m"," hög":"f"," i'":8," i-":"j"," iar":"j"," ied":"d"," iet":"d"," if ":8," iga":"i"," igj":"h"," ihn":9," iht":"m"," ik ":"d"," ilg":"m"," ilm":"g"," ils":7," ily":"i"," isn":8," it'":8," iub":"j"," iy":"m"," iş":"m"," já ":"b"," kje":"h"," ks":"l"," kt":"l"," kuo":"g"," kuu":"g"," kå":"h"," l-":"j"," lh":"b"," lj":"f"," lle":"a"," luu":"g"," lá ":"b"," låt":"f"," m'a":7," m-":"j"," mj":"f"," mni":"l"," muj":"a"," mè":7," n'a":7," n-a":"j"," ne-":"j"," når":"h"," nós":"b"," oam":"j"," ock":"f"," odp":"l"," og ":"h"," ogg":"c"," ogs":"h"," ohn":9," oik":"g"," olh":"b"," olm":"m"," op ":"d"," oth":8," oí":"a"," pe ":"j"," päi":"g"," rz":"l"," s'e":7," s-":"j"," sb":"c"," sd":"c"," sg":"c"," sje":"h"," szc":"l"," szü":"i"," te-":"j"," tiv":"b"," tym":"l"," työ":"g"," täm":"g"," tè":"c"," töb":"i"," tú ":"a"," túl":"i"," ucc":"c"," un'":"c"," uo":"c"," up ":8," usc":"c"," usk":"g"," v-":"j"," veu":7," vri":"d"," vro":"d"," vän":"f"," way":8," wij":"d"," wo ":9," ws":"l"," wur":9," xí":"b"," yh":"g"," yk":"g"," yl":"g"," ym":"g"," yri":"g"," ys":"g"," yü":"m"," za ":"l"," zas":"l"," zaw":"l"," zd":"l"," zi ":"j"," zij":"d"," zm":"l"," zn":"l"," zo ":"d"," zos":"l"," zr":"l"," zu ":9," |":6," ° ":"c"," ½":9," áll":"i"," án":"a"," äls":"f"," än ":"f"," är ":"f"," äta":"f"," äte":"f"," åk":"f"," åp":"h"," åt ":"f"," ça ":7," çal":"m"," ço":"m"," è ":"c"," é ":"b"," ért":"i"," éta":7," été":7," éx":"a"," éé":"d"," ír":"i"," îm":"j"," în":"j"," ôn":"b"," önc":"m"," öpp":"f"," öss":"i"," úg":"i"," új":"i"," ō":9," şe":"m"," şi ":"j"," şt":"j"," ।":6," २":6," ঈ":5," ঋ":5," ঔ":5," ৩":5," ৪":5," ৬":5," ৮":5," ―":"k"," ‟":9," №":"k"," ご":1," ウサギ":1," エレベ":1," コ":1," ジ":1," テ":1," ド":1," ネズミ":1," バ":1," パ":1," フ":1," ボ":1," マ":1," メ":1," 一人":1," 一日":1," 一般的":1," 不好意":2," 両親":1," 中国語":1," 二人":1," 交通事":1," 今 ":1," 今夜":1," 今度":1," 今晩":1," 今朝":1," 今週末":1," 他一":2," 他不":2," 他人":1," 他可能":2," 他在":2," 他把":2," 他有":2," 会議":1," 何時":1," 俺":1," 僕":1," 先週":1," 列車":1," 労働者":1," 北海道":1," 午前中":1," 博物館":1," 合衆国":1," 君":1," 因為":2," 地下鉄":1," 基本的":1," 外国":1," 多分 ":1," 大学":1," 大家":2," 如":2," 子":1," 実際":1," 宿題":1," 富士山":1," 少年":1," 心配":1," 我今":2," 我从来":2," 我从没":2," 我以":2," 我会":2," 我叔叔":2," 我只":2," 我可":2," 我和":2," 我哥哥":2," 我喜":2," 我妹妹":2," 我完全":2," 我就":2," 我希":2," 我弟弟":2," 我必須":2," 我必须":2," 我感觉":2," 我打算":2," 我把":2," 我无法":2," 我明":2," 我昨":2," 我更喜":2," 我最近":2," 我正在":2," 我没":2," 我無法":2," 我父":2," 我爸爸":2," 我現在":2," 我相信":2," 我看":2," 我知":2," 我能":2," 我覺得":2," 我觉":2," 我認為":2," 我认":2," 我讨厌":2," 我需":2," 我非常":2," 所以":2," 所有":2," 放課後":1," 政治家":1," 新聞":1," 旅行":1," 日曜":1," 昨夜":1," 是的 ":2," 時々 ":1," 晩ご飯":1," 最初":1," 最近 ":1," 最近彼":1," 月日":1," 有些人":2," 来週":1," 残念":1," 湯":2," 現在 ":1," 看護婦":1," 私":1," 科学者":1," 突然 ":1," 結婚":1," 結局":1," 萨米":2," 請":2," 警察官":1," 谢谢 ":2," 這":2," 那":2," 電話番":1," 電車":1," 風邪":1," 飛行":1," 갈 ":3," 같":3," 걱정":3," 걸":3," 결국 ":3," 결혼":3," 경찰":3," 계속":3," 곧 ":3," 공":3," 과학":3," 괜찮":3," 궁금":3," 날":3," 남":3," 넌 ":3," 널 ":3," 네":3," 년 ":3," 노래":3," 노력":3," 누":3," 당":3," 대":3," 더":3," 동":3," 돼 ":3," 되":3," 될 ":3," 두 ":3," 둘 ":3," 때":3," 떠났":3," 또 ":3," 많":3," 먹":3," 메":3," 몇 ":3," 모":3," 몰랐":3," 못":3," 문":3," 뭘 ":3," 미":3," 바":3," 방법":3," 배":3," 번역":3," 벌써 ":3," 본 ":3," 볼 ":3," 봐 ":3," 부":3," 비":3," 살":3," 새 ":3," 생":3," 선생":3," 소":3," 싶":3," 알":3," 언":3," 엄청 ":3," 영":3," 오":3," 완전":3," 왜":3," 운전":3," 음식":3," 음악":3," 잘":3," 재미":3," 저":3," 적":3," 전":3," 절대":3," 점심 ":3," 정":3," 조금":3," 좀":3," 죄송":3," 줄 ":3," 중":3," 줘 ":3," 진짜":3," 질문":3," 집":3," 참 ":3," 처음 ":3," 친구":3," 침대":3," 커피":3," 컴퓨":3," 큰 ":3," 텔레비":3," 파티":3," 프":3," 학교":3," 학생":3," 할":3," 함께":3," 항상":3," 행복":3," 훨씬 ":3," -":9,"'ae":"c","'ai ":7,"'aim":7,"'cl":8,"'d ":8,"'da":"m","'e-":"c","'ea":7,"'eb":"c","'ell":7,"'ep":"c","'eq":"c","'fb":"c","'ha ":"c","'ho ":"c","'hu":7,"'il ":7,"'j":"d","'k":"d","'ll":8,"'ni":"m","'on ":7,"'ou":7,"'ov":"c","'re ":8,"'uc":"c","'uf":"c","'ug":"c","'une":7,"'uo":"c","'uv":"c","'ve":8,"'y ":7,"'ye ":"m","'yi":"m","'à":7,"'á":"b","'â":7,"'è ":"c","'é":7,"'ê":7,"'î":7,"'ü":"m","(-":"k","(q":"b","(y":"a","(z":9,"-$":"n","-'":"m","-ai ":"j","-am ":"j","-ar ":"j","-au ":"j","-ce ":7,"-ell":7,"-il ":7,"-je ":7,"-l ":"j","-lh":"b","-lo ":"b","-là":7,"-me ":"b","-mi ":"j","-moi":7,"-t-":7,"-tu ":7,"-ul":"j","-vou":7,"-à":7,"-ã":"b","-ê":7,"-í":"b","-ó":"i","-ö":"i","-ş":"j","a'd":"m","a'y":"m","aag ":"d","aak ":"d",aakt:"d","aam ":"d",aav:"g",abg:9,acj:"l",acz:"l",adei:"b",afí:"a",agte:9,"agy ":"i",ahd:"g","ahr ":9,aike:"g",aior:"b","ais-":7,aiut:"c",aixo:"b",ajud:"b",alál:"i",amay:"m",ambé:"b","an't":8,apm:"m",aquí:"a",ardz:"l",areb:"c",arfö:"f",arum:9,arü:9,arş:"m",aszt:"i",atok:"i",atât:"j",aufe:9,augh:8,auj:7,autt:"g",avea:"j",avev:"c",avne:"h",avve:"c",avô:"b",ayac:"m",ayud:"a",ayó:"a",azla:"m","azt ":"i",azón:"a",azú:"a",aá:"i",aã:"b",aä:"g",aî:7,aö:"i",aún:"a",baix:"b",baş:"m",berä:"f",besz:"i",bge:9,"biz ":"m",bién:"a",blij:"d","bly ":8,brz:"l",brí:"a","bst ":9,buie:"j",bunu:"m",buon:"c",buu:"d","bym ":"l",bã:"b",bäs:"f",bäu:9,"bè ":"c",bém:"b","bí ":"a","bía ":"a",bî:7,bô:"b",börj:"f",bù:"c",büc:9,"c'es":7,"c'è":"c",cche:"c",ccia:"c",cció:"a",ceea:"j",cepu:"j",chce:"l",chg:9,chk:9,chod:"l",chä:9,chí:"a",chö:9,chü:9,ciod:"j",ciun:"j",ciut:"c",cji:"l",ckan:"f",cma:"j",cois:"b",coj:"a",colh:"b",conh:"b","cos'":"c",csa:"i",cse:"i",csi:"i",cuan:"a",cuch:"a",cuel:"a",cuen:"a",cug:"c",cuie:"j",cuol:"c",cuá:"a","cz ":"l",czas:"l","cze ":"l",czeg:"l",czek:"l",czn:"l",czo:"l",czu:"l",czy:"l",câi:"j",câm:"b",cât:"j",cã:"b",cä:9,cç:"b",cên:"b","cí ":"a","d'h":7,"d'v":8,"d'è":"c","d)":8,daag:"d",daar:"d",daq:"b",davv:"c",daví:"a",daş:"m",ddl:8,degl:"c",deia:"b",dein:9,deir:"b","deu ":"b",deut:9,dey:"m",didn:8,dijo:"a",dinh:"b",dly:8,"dn'":8,"don'":8,dovr:"c",dovu:"c",drik:"h",drz:"l",drí:"a",drü:9,"dta ":"i",dtam:"i","du-":"j",duw:"d",duy:"m","dzi ":"l",dzia:"l",dzie:"l",dzis:"l",dzo:"l",dzy:"l",dà:"c","dá-":"b",dã:"b","dä ":"g","dän ":"g",dät:"g","då ":"f",dål:"f",dè:7,dép:7,dê:"b","dí ":"a","día ":"a",días:"a",dîn:7,dô:"b",dörr:"f",dúv:"b",dû:7,"dü ":"m","dün ":"m",dō:9,"e'r":8,"e'v":8,eady:8,easc:"j",eaun:"j",eave:8,ebè:"c",ecek:"m",eceu:"b",ecir:"a",ecv:"j",ediy:"m",edzi:"l","eea ":"j",eeft:"d",efd:"d",egou:"b",egé:"i","ehe ":9,"ehr ":9,ehs:9,"eht ":9,einm:9,"eio ":"b",eix:"b",ejor:"a",ejó:"a","ekk ":"h",elbs:9,eliy:"m",ellä:"g",elq:7,emey:"m",emiy:"m",emps:7,"emu ":"l","en't":8,enx:"b",enía:"a",eopl:8,eoz:"c",epoi:"b",epui:7,erug:"d","es-t":7,"es-v":7,"esc ":"j",esoi:7,eszc:"l",euch:9,eux:7,"ev'":"c",evn:"h",ewh:8,eyec:"m","eyi ":"m","ezt ":"i",ezte:"i",ezza:"c",ezó:"a",eã:"b","eä ":"g",eça:"b","eço ":"b",eë:"d","eí ":"a",eía:"a",eíb:"a",eíd:"a",eî:"j",eïn:"d",eón:"a",eû:7,"e‘":9,"fa'":"c",fap:"j",faut:7,fazl:"m","fd ":"d","fde ":"d",fds:"d",feel:8,fej:"i",few:8,ffn:9,fft:9,fiec:"j",figl:"c",fikk:"h",filh:"b",flé:7,foar:"j",fois:7,forh:"h",frum:"j",frå:"f",frè:7,frü:9,fuer:"a",fuo:"c",fà:"c",fâr:"j",fã:"b",fäh:9,fåg:"f",fç:"m","fè ":"c",fèr:7,fía:"a",fô:"b",förs:"f",förä:"f",fû:7,füh:9,"g)":8,gaat:"d",ganh:"b",gdy:"l",gdz:"l",gece:"m",geef:"d",geht:9,gesa:9,geï:"d",ggh:"c","ggi ":"c",ggia:"c",ggs:8,ghb:8,ghl:8,giap:"c",gick:"f",gikk:"h",gioc:"c",giov:"c",gitm:"m",gjer:"h",glei:9,glez:"j",glio:"c",glöm:"f",glü:9,goed:"d",gof:"c",good:8,"gou ":"b",gråd:"h",grü:9,gså:"h",gth:8,guf:"c",guma:"b",guv:"j",gye:"i",gyi:"i",gynn:"h",gynt:"h",gyo:"i",gysz:"i","g ":9,gând:"j",gã:"b",gåe:"h",gån:"f",gè:7,gée:7,gía:"a",görm:"m",görü:"m",gù:"c","gún ":"a","gün ":"m",güz:"m","h)":9,hace:"a",haci:"a",hagy:"i",hci:"l",hdä:"g","he'":8,hear:8,hebb:"d","hed ":8,heef:"d","hey'":8,hiam:"c","hij ":"d",hijo:"a",hjem:"h",hjer:"h",hlen:9,hlt:9,hly:8,hlä:9,hnen:9,hnl:9,"ho'":8,hodz:"l",hogy:"i",homb:"a",houd:"d",houg:8,hoy:"a","hoz ":"i",hoş:"m",hrer:9,hrh:9,hrl:9,hrs:9,hrt:9,"hst ":9,http:"k",htä:"g",huo:"g",huvu:"f",huw:"d",hvé:"a",hyv:"g",hár:"i",hã:"b","hän ":"g",häne:"g","här ":"f",hål:"f",hån:"h",håp:"h",hç:"m","hí ":"a",hís:"a",hív:"i",hô:7,höv:"f",hō:9,hş:"m","h‘":9,"i'l":8,"i'm":8,"i'v":8,iacc:"c",iagg:"c",iapp:"c",ibt:9,icz:"l",idzi:"l",idä:"g","iec ":"l",iedy:"l",iedz:"l","iej ":"l",iejs:"l",ielä:"g",igje:"h",igk:9,igvi:"h",igå:"f","ihm ":9,ihmi:"g","ihn ":9,"ihr ":9,ihå:"f",iic:"j",iik:"g",iim:"g","iin ":"g",ijb:"d",ijd:"d",ijf:"d",ijg:"d",ijh:"d","ijk ":"d",ijke:"d","ijn ":"d",ijp:"d",ijt:"d",ijv:"d",ijz:"d",iliy:"m",ilye:"i",incs:"i",inál:"i",iní:"b",ioda:"j",ious:8,ioè:"c",irim:"m",irj:"g",irkl:9,"is-j":7,issz:"i",isä:"g","it's":8,"iu-":"b",iua:"j",iuc:"c",iune:"j",iuo:"c",iusc:"c",iuto:"c",ivät:"g",ixar:"b",iye:"m",iyi:"m",iyo:"m",izio:"c",ià:"c",iã:"b","iä ":"g",iça:"b",iço:"b",ièm:7,iée:7,"ién ":"a",iê:"b",ië:"d",ií:"i",iô:"b",iù:"c",iü:"i","iş ":"m",işe:"m",işi:"m","j'":7,"j-":"i",jaar:"d","jag ":"f",jahr:9,jds:"d",jdt:"d",jedz:"l","jeg ":"h",jego:"l",jelp:"h",jert:"h",jetz:9,jeun:7,"jf ":"d",jft:"d","jg ":"d",jge:"d",jgt:"d",jij:"d",jj:"i",jkh:"d",jks:"d",jkt:"d","jl ":"d",jls:"d",jnl:"d",jns:"d",jnt:"d",joit:"g",jota:"g",joue:7,"jp ":"d",jpe:"d",jpt:"d",jull:"d",juo:"g",juu:"g",jze:"d",jzi:"d",jà:7,jár:"i",ját:"i",jã:"b","jä ":"g",jälv:"f",jå:"h","jé ":"a",jól:"i","kaa ":"g",kauf:9,kijk:"d",kims:"m",kiş:"m",kjed:"h",kjel:"h",kjem:"h",kjen:"h",kjer:"h",kkä:"g",knew:8,know:8,kolm:"g",komt:"d",ksj:"h",kså:"f",kuin:"g",kvel:"h",kvä:"f",kâ:"m","kä ":"g",känd:"f",käv:"g",kåt:"h",kç:"m",kép:"i",kér:"i",kés:"i",két:"i","kö ":"g",köny:"i",köz:"i",kú:"i",kû:"m",kō:9,kş:"m","l'f":"c",laub:9,laş:"m",lbst:9,lcos:"c",lcun:"c","ldu ":"m",left:8,letz:9,"lf-":8,lfd:"d",lgd:"d",lgoz:"i",lgui:"a",lgum:"b",lgú:"a",ligv:"h",lijk:"d",liw:"l",lkä:"g","ll'a":"c","ll'e":"c","llä ":"g",lmay:"m",lmiy:"m",lox:"c",lsj:"d",ltc:"j",ltij:"d",ludz:"l",lvf:"h",lví:"a",lway:8,lyck:"f","lz ":9,lâng:"j",lã:"b",lära:"f",låd:"f",låg:"f","låt ":"f",lè:7,lên:"b","lí ":"a",lía:"a",lû:7,"m'u":"m","m'è":"c","m-v":"b",mawi:"l",mbié:"a","mdi ":"m",megt:"i",megy:"i",mehr:9,meir:"b",mejo:"a",melh:"b",meye:"m",meyi:"m",miei:"c",migh:8,migl:"c",mijn:"d","miz ":"m",miè:7,miş:"m",mjö:"f",mmt:9,mmä:"g","mo-":"b",moet:"d",moje:"l",mq:"c",mulh:"b",muut:"g","muy ":"a",myck:"f",mye:"h",myö:"g","m ":"b",mâi:"j",mânc:"j",mã:"b","mä ":"g",mås:"f",måte:"h",mèr:7,mée:7,mêm:7,"mí ":"a",mía:"a",mój:"l",möc:9,mún:"a",mû:7,müss:9,mş:"m","n'ai":7,"n'd":"m","n't ":8,"n'y":7,"n'è":"c",nagy:"i",namn:"f",nauc:"l",nció:"a",nehm:9,neue:9,next:8,nft:9,nfí:"a",nhec:"b","nho ":"b",nhv:"h",niej:"l",niin:"g",niy:"m",niè:7,nká:"i",nly:8,nnhe:"h",nnr:"h",nnsk:"h",nnst:9,"nnt ":9,nnte:9,nnå:"h",nodi:"d",nooi:"d",noth:8,nouv:7,"now ":8,noë:7,"nq ":7,nskj:"h","nu-":"j",nuev:"a",nung:9,nuov:"c",nuw:"d",nuş:"m",nvän:"f",nych:"l",nyel:"i",nyth:8,nyv:"i",nyá:"i","nz'":"c",nzio:"c","n­":9,"nál ":"i",nã:"b","nä ":"g",näi:"g",näk:"g",någ:"f","når ":"h",nçai:7,nças:"b",nè:7,née:7,nék:"i",néz:"i","nía ":"a",níc:"b","nós ":"b",nù:"c",nş:"m","n‘":9,"o'c":8,obú:"a",ocm:"j",ocui:"j",ocuk:"m",ocz:"l",odob:"l",odpo:"l",odzi:"l",oede:"d",oeg:"d",oek:"d",oesn:8,oew:"d",ofd:"d",oike:"g",oitt:"g",oiu:"j",oix:7,ojc:"l",ojeg:"l",olur:"m",omú:"a",onnt:9,ooit:"d",opd:"d",opg:"d",oruz:"m",osaa:"g",ossz:"i",otde:"j","ou'":8,ough:8,oujo:7,ould:8,ourq:7,ourr:7,ouw:"d",oué:7,"ov'":"c",ovre:"c",ovv:"c","ow'":8,owd:8,"owi ":"l",oyf:8,oyn:"m",oyé:7,ozw:"l",oã:"b",oå:"f",oça:"b",oço:"b","oè ":"c",oël:7,oír:"a",oî:7,oó:"b",où:7,oû:7,"o₂":9,palj:"g",panh:"b",paur:"c",peak:8,pegn:"c",peop:8,peó:"a","pf ":9,pfl:9,pge:"d",piè:7,pmak:"m",pmay:"m","po'":"c",poat:"j",pouv:7,powi:"l",prek:"d",prz:"l",prè:7,pued:"a",puhu:"g",puoi:"c",pués:"a",pyta:"l",pà:"c",pâi:"j",pã:"b",pè:7,pée:7,péu:"b",pôd:"b",pş:"m","q-":"i",qq:"c","qu'":7,qur:8,"quí ":"a","r-o ":"j",raag:"d",rawd:"l","re's":8,"ren'":8,reí:"a",rför:"f",rgd:"d",rijk:"d","rió ":"a",rjoi:"g",rkj:"h",rlf:8,rly:8,rmí:"a",rodz:"l",roun:8,"row ":8,rquo:7,rrow:8,rske:"h",rskj:"h",rsoa:"j",rsq:7,rsök:"f",ruik:"d",ruke:"h",rvä:"f",rykk:"h",rzt:9,rzy:"l","r­":9,rà:"c","rá-":"b",râd:"j",râs:"j",rã:"b",räff:"f",räg:9,räu:9,råg:"f",rån:"f","rè ":"c",rèr:7,"rí ":"a",rías:"a",rív:"b",rôl:7,rù:"c",rû:7,rō:9,"s'es":7,"s'il":7,"s's":8,"s'è":"c","saa ":"g",saan:"g",says:8,saí:"b",saú:"b",sciu:"c",scuc:"a",segí:"i",sehr:9,selb:9,setz:9,"seu ":"b",seul:7,"she ":8,shed:8,shl:8,shr:8,sicu:"c",siin:"g",siit:"g",siy:"m","siz ":"m",siä:"g",siè:7,sión:"a",sjuk:"f",sjö:"f",skje:"h",sks:8,"sn'":8,snil:"h",snö:"f",soas:"b",sotr:"a",spué:"a",ssoa:"b",ssza:"i",ssze:"i",suno:"c",suoi:"c",suur:"g",svå:"f",syy:"g",syö:"g",szab:"i",szik:"i",szy:"l",szá:"i",szé:"i",szí:"i",szül:"i","s­":9,sà:"c",sári:"b","sä ":"g",såd:"f",såg:"f",sè:7,sée:7,ség:"i",sê:"b","sí ":"a",sív:"b",sólo:"a",sô:"b",söy:"m",sù:"c",sû:7,süre:"m","t'v":8,"t'è":"c","t-ce":7,"t-il":7,"t-o ":"j","taa ":"g",tasj:"h",tci:"j",tdea:"j",teir:"b",temt:"h",tení:"a",tept:"j","teu ":"b",tfen:"m",thd:8,they:8,thre:8,tidl:"h",tilb:"h",tinh:"b",tiy:"m",tiè:7,tjen:"h",tly:8,tmek:"m",tmey:"m",tné:"i",toar:"j","tog ":"f",touj:7,tq:9,"tr-":"j",trl:"k",trz:"l",träd:"f",trè:7,ttaa:"g",ttè:"c",tuom:"g",tuvo:"a",tué:7,tvä:"f",två:"f","ty-":8,tylk:"l",tyy:"g","tze ":9,tzl:9,"tzt ":9,tzte:9,tzu:9,tà:"c","tá-":"b","tál ":"i",táx:"b",tâi:"j",tâl:"j",tâmp:"j",târ:"j","tât ":"j",tã:"b","tä ":"g",täi:"g",tåg:"f",tç:"m","tè ":"c",tée:7,ték:"i","tél ":"i",têm:"b",tên:"b","tí ":"a",tío:"a","tól ":"i",tóq:"b",tù:"c","tü ":"m","tün ":"m",tünk:"i",tō:9,"t‘":9,"u'a":7,"u'e":7,"u'i":7,"u'l":8,"u'o":7,"u'r":8,"u'u":7,"u'v":8,"u-i":"j","u-mi":"j",ualc:"c",uap:"a",uase:"b",ucru:"j",ucz:"l",udc:"c",udom:"i",udzi:"l",uede:"a",uego:"a",ueva:"a",uevo:"a",ufen:9,ufg:9,ufz:9,ught:8,ugü:"m",uii:"c",uink:"g",uiu:"b",uién:"a",uió:"a",ujb:"j",ujer:"a",ukaa:"g",umg:9,umne:"j","unn ":"h",unns:"h",unuz:"m",uoc:"c",uog:"c","urd'":7,ureu:7,urü:9,used:8,usst:9,uude:"g",uul:"g","uur ":"d",uuri:"g",uuta:"g",uutt:"g",uvez:7,"uvo ":"a",uvé:7,"uw ":"d",uwd:"d",uws:"d",uwt:"d","ux-":7,uyd:"m",uyor:"m",uyu:"m",uyó:"a",uán:"a",uã:"b",uä:9,uè:7,uée:7,"uém ":"b",uên:"b",uó:"a",uşu:"m","v'e":"c","v'è":"c","v-a":"j","vaa ":"g",vagy:"i",vaik:"g",való:"i",varf:"f","vec ":7,veie:"h",very:8,vesz:"i",veva:"c","vez-":7,vgj:"h",vij:"d",vió:"a","vn ":"h",vnet:"h",voas:"j",vogl:"c",voln:"i",voor:"d",votr:7,"vou ":"b",voul:7,vreb:"c",vreo:"j",vroe:"d",vrou:"d",vuel:"a",vuoi:"c",vuol:"c",vuto:"c",vver:"c",vvo:"c",vz:"m",vâr:"j",vã:"b","vä ":"g",väg:"f",väh:"g",väld:"f",vänd:"f","vät ":"g","vå ":"f",våk:"h",vån:"f",vè:7,vée:7,"vía ":"a",vî:7,"vô ":"b",vú:"i",vş:"m","w's":8,waar:"d",wahr:9,wasn:8,wav:8,ways:8,wcz:"l","we'":8,wea:8,weer:"d",weh:9,wf:8,whe:8,why:8,wia:"l",widz:"l",wiec:"l",wiek:"l",wiem:"l","wil ":"d","wir ":9,wird:9,wirk:9,with:8,"wl ":8,wly:8,woh:9,woi:"l",woj:"l","won'":8,woon:"d",woor:"d",woul:8,wró:"l",wsz:"l",wurd:9,wv:"d",www:"c",wyc:"l",wye:8,wyg:"l",wyj:"l",wyk:"l",wym:"l",wyp:"l",wys:"l",wz:"l",wá:"a",wä:9,wó:"l",wö:9,wü:9,xad:"b",xb:"i","xe-":"b",xed:8,xei:"b",xg:9,xk:9,xm:9,xou:"b",xr:"i",xs:9,xz:9,xã:"b",xíc:"b",xō:"a","y'l":8,"y'n":"m","y'r":8,"y'v":8,"y'y":"m",yaca:"m",yapt:"m",yaş:"m",yby:"l",yci:"l",ycka:"f",ycke:"f",yckl:"f",ycz:"l","ydi ":"m",yea:8,yece:"m",yeu:7,yfr:8,ygd:"h",yhd:"g",yht:"g","yim ":"m",yiy:"m",ykd:"h",ymr:"h",ynyt:"g",yord:"m",yoru:"m",your:8,yrit:"g",ythi:8,ytä:"g",yvin:"g",ywh:8,yâ:"m",yä:"g",yí:"i",yō:9,"z'a":"c","z'o":"c","z-v":7,zaws:"l",zco:"a",zcz:"l",zego:"l",ziec:"l",ziej:"l","zij ":"d",zijn:"d",zinh:"b",ziy:"m","zla ":"m",zoe:"d",zond:"d",zost:"l",zott:"i",zq:"a",zro:"l",ztá:"i",zuu:"d",zwei:9,zyb:"l",zyc:"l",zyj:"l",zyma:"l",zys:"l",zyt:"l",zyw:"l","zz'":"c","zzo ":"c",zzá:"i",zám:"i",zâm:"j",zã:"b",zä:9,zê:"b",zô:"b",zúc:"a","| ":6," =":9," i":9," p":7," u":9," w":"l"," z":"l",ª:"b","­b":9,"­d":9,"­s":9,"²'":"m","· ":"e",ºc:"a","½ ":9,ß:9,"à-":7,àq:"b",às:"b","à ":7,"á'":"i","á-l":"b",áa:"i",ább:"i","ád ":"i","ág ":"i",água:"b",áis:"a",ák:"i",áln:"i",álta:"i","ám ":"i",ána:"i",ány:"i",áo:"i","ár ":"i","ára ":"i",ário:"b",áro:"i",áso:"i","ást ":"i",ásá:"i","át ":"i",áts:"i",átt:"i",ável:"b",áy:"a",áá:"i",áé:"i",áí:"i",áó:"i",áú:"i",áü:"i","â ":"m",âc:7,âg:7,âh:"m","âi ":"j",âin:"j",âk:"m",âln:"j",âmpl:"j",ânca:"j","ând ":"j",ânz:"j",ârs:"j",ârt:"j",ârz:"j","âs ":"j",âu:"j",ây:"m","ã ":"b","ã-":"b",ãe:"b",ãos:"b",ãs:"b",ãz:"b","ä-":"g",äa:"g",äch:9,ädc:9,ädd:"f",äffa:"f",äga:"f",ägg:"f",ägt:9,ähd:"g",ähl:9,ähr:9,ähä:"g",äin:"g",äisi:"g",äit:"g",äiv:"g",äj:"g",äks:"g",äkt:"f",äkä:"g","äl ":"f",äldi:"f","äll ":"f",ällä:"g",älp:"f",älsk:"f","älv ":"f",älä:"g",ämn:"f",ämä:"g",ända:"f",änel:"g","äni ":"g",äny:"g",änä:"g",äq:9,ärn:"f","äsi ":"g",ästa:"f","äta ":"f","ätt ":"f",ätta:"f",ätz:9,ätä:"g",äuf:9,äum:9,ävi:"g",ävä:"g",äx:"f",äy:"g",äz:9,ää:"g",äö:"g",åa:"f",åb:"f",åda:"f",ådi:"h",åel:"h","åg ":"f",åga:"f",åge:"f",ågo:"f",ågr:"f",åh:"f",åka:"f",åkt:"f",åla:"f",åll:"f",åm:"f","ån ":"f",åna:"f",åned:"h",ång:"f",ånn:"h",åpn:"h",åra:"f","åre ":"h",årl:"h",årn:"h",åste:"f",åta:"f","åte ":"h",åtte:"h",åvi:"h",æ:"h","ç ":"m","ç'":"m","ças ":"b",çb:"m",çe:"m",çg:"m",çi:"m",çk:"m",çl:"m",çm:"m",çoc:"m",çok:"m",ços:"b",çou:"b",çr:"m",çs:"m",çt:"m",çy:"m",çá:"b",çã:"b",çç:"m",çó:"b",çö:"m",çú:"b",çü:"m",èb:7,èc:7,èd:7,èg:7,èl:7,èq:7,ès:7,èt:7,èv:7,"è ":"c","é'":"i",écl:7,écou:7,écr:7,ées:7,éfé:7,"ég ":"i","ék ":"i",éke:"i",élet:"i",éln:"i",éno:7,ény:"i",énz:"i","ért ":"i",ész:"i","ét ":"i",étai:7,étud:7,"été ":7,"éu ":"b",éâ:7,éç:7,één:"d",éü:"i","ê ":"b","ê-":"b",êb:"b",êc:7,êl:7,"êm ":"b","ême ":7,ênc:"b",ênd:"b",êni:"b",êp:7,ês:"b",êt:7,êu:"b",êv:7,êx:"b",ëe:"d",ëi:"d",ën:"d",ër:"d",ëz:"d",ì:"c","í-":"b",ían:"a",ík:"i",íng:"b","ío ":"a",íos:"a",íss:"b",íç:"b","î ":"m",îc:7,îi:"j","îl ":"j",îmb:"j",îmi:"j",împ:"j","în ":"j",înc:"j",înd:"j",înf:"j",îng:"j",înn:"j",înr:"j",îns:"j",înt:"j",înv:"j",ît:7,îş:"j",ïf:7,ïnt:"d",ñ:"a",ò:"c","ó-":"i",óa:"i",ócu:"b",óe:"i",óh:"i","ój ":"l","ólo ":"a","ómo ":"a",ónd:"a",óo:"i",ópr:"b",óry:"l",óu:"i",ów:"l",óá:"i",óé:"i",óí:"i",ôni:"b",ôp:7,ôq:"b",ôr:"b",ôs:"b",ôt:7,ôv:"b",õ:"b",öbb:"i",öch:9,öda:"f",öe:9,ögon:"f",öhn:9,öi:"g",öjd:"f",öjl:"f",önce:"m",önnt:9,öo:"g",öra:"f",örja:"f",örsö:"f",örté:"i",össz:"i",ötü:"m",öw:9,öyle:"m",öä:"g",öç:"m",öö:"g",öş:"m",ø:"h","ú-":"i",úe:"a",úgy:"i",úi:"i","új ":"i",úk:"i",úo:"a",úvi:"b",úy:"a","û ":7,ûl:7,ûr:7,ût:7,"ü'":"m",üch:9,ück:9,üen:"a",ühl:9,ühr:9,ünf:9,"ünk ":"i",ünm:"m",ünü:"m",ütf:"m",ütz:9,ütü:"m",üy:"m","üz ":"m",üç:"m",üé:"a",üí:"a",üş:"m",ā:8,ă:"j",ą:"l",ć:"l",ę:"l",ğ:"m","ī ":9,ı:"m",ł:"l",ń:"l","ō ":9,ōb:9,ōc:"a",ōg:9,ōk:9,ōs:9,ōt:9,ő:"i",œ:7,ś:"l","ş'":"m",şam:"m",şan:"m",şar:"m",şb:"m",şek:"m",şey:"m",şf:"m",şg:"m",şh:"m","şi-":"j",şim:"m",şk:"m",şl:"m",şm:"m",şr:"m",şs:"m",ştu:"m",şv:"m",şy:"m",şç:"m",şö:"m",şü:"m",şş:"m",š:"g",ţ:"j",ū:9,ű:"i",ź:"l",ż:"l",ș:"j",ț:"j","́":"k","̇":"m","΄":"e",ΐ:"e",ά:"e",έ:"e",ή:"e",ί:"e",α:"e",β:"e",γ:"e",δ:"e",ε:"e",ζ:"e",η:"e",θ:"e",ι:"e",κ:"e",λ:"e",μ:"e",ν:"e",ξ:"e",ο:"e",π:"e",ρ:"e",ς:"e",σ:"e",τ:"e",υ:"e",φ:"e",χ:"e",ψ:"e",ω:"e",ϊ:"e",ό:"e",ύ:"e",ώ:"e",а:"k",б:"k",в:"k",г:"k",д:"k",е:"k",ж:"k",з:"k",и:"k",й:"k",к:"k",л:"k",м:"k",н:"k",о:"k",п:"k",р:"k",с:"k",т:"k",у:"k",ф:"k",х:"k",ц:"k",ч:"k",ш:"k",щ:"k",ъ:"k",ы:"k",ь:"k",э:"k",ю:"k",я:"k",ё:"k",ѣ:"k","ְ":"n","ֱ":"n","ֲ":"n","ִ":"n","ֵ":"n","ֶ":"n","ַ":"n","ָ":"n","ֹ":"n","ֻ":"n","ּ":"n","ֽ":"n","־":"n","ׁ":"n","ׂ":"n",א:"n",ב:"n",ג:"n",ד:"n",ה:"n",ו:"n",ז:"n",ח:"n",ט:"n",י:"n",ך:"n",כ:"n",ל:"n",ם:"n",מ:"n",ן:"n",נ:"n",ס:"n",ע:"n",ף:"n",פ:"n",ץ:"n",צ:"n",ק:"n",ר:"n",ש:"n",ת:"n","׳":"n","״":"n","،":"o","؛":"o","؟":"o",ء:"o",آ:"o",أ:"o",ؤ:"o",إ:"o",ئ:"o",ا:"o",ب:"o",ة:"o",ت:"o",ث:"o",ج:"o",ح:"o",خ:"o",د:"o",ذ:"o",ر:"o",ز:"o",س:"o",ش:"o",ص:"o",ض:"o",ط:"o",ظ:"o",ع:"o",غ:"o",ـ:"o",ف:"o",ق:"o",ك:"o",ل:"o",م:"o",ن:"o",ه:"o",و:"o",ى:"o",ي:"o","ً":"o","ٌ":"o","ٍ":"o","َ":"o","ُ":"o","ِ":"o","ّ":"o","ْ":"o","٠":"o","١":"o","٩":"o",ٱ:"o",ک:"o",ی:"o","ँ":6,"ं":6,"ः ":6,अ:6,आ:6,इ:6,ई:6,उ:6,ऊ:6,ए:6,ऐ:6,ऑ:6,ओ:6,औ:6,क:6,ख:6,ग:6,घ:6,च:6,छ:6,ज:6,झ:6,ट:6,ठ:6,ड:6,ढ:6,ण:6,त:6,थ:6,द:6,ध:6,न:6,प:6,फ:6,ब:6,भ:6,म:6,य:6,र:6,ल:6,व:6,श:6,ष:6,स:6,ह:6,"़":6,"ा":6,"ि":6,"ी":6,"ु":6,"ू":6,"ृ":6,"ॅ":6,"े":6,"ै":6,"ॉ":6,"ो":6,"ौ":6,"्":6,"०":6,"१":6,"२ ":6,"५ ":6,"९":6,"ঁ":5,"ং":5,অ:5,আ:5,ই:5,উ:5,এ:5,ঐ:5,ও:5,ক:5,খ:5,গ:5,ঘ:5,ঙ:5,চ:5,ছ:5,জ:5,ঝ:5,ঞ:5,ট:5,ঠ:5,ড:5,ঢ:5,ণ:5,ত:5,থ:5,দ:5,ধ:5,ন:5,প:5,ফ:5,ব:5,ভ:5,ম:5,য:5,র:5,ল:5,শ:5,ষ:5,স:5,হ:5,"়":5,"া":5,"ি":5,"ী":5,"ু":5,"ূ":5,"ৃ":5,"ে":5,"ৈ":5,"ো":5,"ৌ":5,"্":5,ৎ:5,"০":5,"১":5,"২":5,"৩ ":5,"৪ ":5,"৫":5,"৬ ":5,"৭":5,"৮ ":5,"৯":5,ก:4,ข:4,ค:4,ง:4,จ:4,ฉ:4,ช:4,ซ:4,ญ:4,ฎ:4,ฏ:4,ฐ:4,ณ:4,ด:4,ต:4,ถ:4,ท:4,ธ:4,น:4,บ:4,ป:4,ผ:4,ฝ:4,พ:4,ฟ:4,ภ:4,ม:4,ย:4,ร:4,ฤ:4,ล:4,ว:4,ศ:4,ษ:4,ส:4,ห:4,ฬ:4,อ:4,ฮ:4,ะ:4,"ั":4,า:4,ำ:4,"ิ":4,"ี":4,"ึ":4,"ื":4,"ุ":4,"ู":4,เ:4,แ:4,โ:4,ใ:4,ไ:4,ๆ:4,"็":4,"่":4,"้":4,"๊":4,"๋":4,"์":4,ὰ:"e",ὸ:"e","​e":"d","​v":"d","​y":"m","‌":5,"‏":"o","― ":"k","‘ ":9,"‘s":"d","‚":9,"‟ ":9,"‬":"o","‮":"o"," °":9,"№ ":"k","−":9,あ:1,い:1,う:1,え:1,お:1,か:1,が:1,き:1,く:1,け:1,こ:1,さ:1,し:1,じ:1,す:1,せ:1,そ:1,た:1,だ:1,ち:1,っ:1,つ:1,て:1,で:1,と:1,ど:1,な:1,に:1,ね:1,の:1,は:1,ば:1,へ行:1,べ:1,ま:1,み:1,め:1,も:1,ゃ:1,や:1,よ:1,ら:1,り:1,る:1,れ:1,ろ:1,わ:1,を:1,ん:1,ア:1,イ:1,オオカミ:1,カナダ:1,カ合衆国:1,キャプテ:1,ク:1,シャ:1,ジャ:1,ジョ:1,ス:1,タバコ:1,チョコ:1,ッ:1,ティ:1,テレ:1,ディズニ:1,ト:1,ニュ:1,プレゼ:1,プロジェ:1,ミュニケ:1,ム:1,ラ:1,リ:1,ル:1,レビ:1,ン:1,"・・・":1,ー:1,一下:2,一度:1,一日中:1,"一本書 ":2,一生懸:1,一番:1,一緒:1,一起:2,一週間:1,上げ:1,上手:1,"下雨 ":2,不会:2,不可能的:2,"不在家 ":2,不思議:1,不想:2,不是:2,不注意:1,不知:2,不能:2,不要:2,世界一周:1,世界上:2,世界中:1,世界大戦:1,世界平和:1,"东西 ":2,个:2,中華料理:1,为:2,丽:2,么:2,之:2,也:2,书:2,"了 ":2,了一:2,了他:2,了我:2,事務所:1,二次世界:1,交通渋滞:1,人々:1,人間:1,什:2,今天:2,"今日 ":1,仕事:1,"他 ":2,他是:2,他的:2,们:2,"任何人 ":2,会社:1,但:2,住在:2,"作 ":2,你:2,來:2,"個問題 ":2,"個小時 ":2,們:2,"候 ":2,做:2,儿:2,冷蔵庫:1,出発:1,到了:2,勉強:1,動車事故:1,医者:1,"去 ":2,"去学校 ":2,友達:1,发:2,可以:2,可俗話又:2,"可能的 ":2,名前:1,"名字 ":2,吗:2,吧:2,告诉:2,"呢 ":2,"咖啡 ":2,哪:2,"啊 ":2,嗎:2,"回家 ":2,図書館:1,在波士頓:2,在波士顿:2,"地方 ":2,"多少錢 ":2,"多少钱 ":2,大丈夫:1,大統領:1,天早上:2,天然資源:1,她:2,"好 ":2,好的:2,如果:2,姆:2,委員会:1,子供:1,"学习 ":2,学校へ:1,学生時代:1,孩:2,學:2,它:2,宇宙飛行:1,宙飛行士:1,家族:1,对:2,對:2,就是:2,工作:2,"巧克力 ":2,已:2,庁所在地:1,应该:2,开:2,弁護士:1,彼女:1,很:2,怎:2,息子:1,您:2,想要:2,"意思 ":2,"感兴趣 ":2,懸命勉:1,"我 ":2,我々:1,我一:2,我不:2,我在:2,我希望:2,我想:2,我是:2,我有:2,我的:2,我第一次:2,我要:2,我觉得:2,我需要:2,"房子 ":2,所有的:2,手伝:1,手紙:1,"打網球 ":2,打電話給:2,携帯電話:1,日本語:1,早寝早起:1,时:2,明天:2,明日:1,映画:1,昨天:2,昨日:1,是一:2,是不:2,"是多少 ":2,是我:2,時候:2,時間以上:1,晚:2,曜日:1,會:2,有一:2,有人:2,朋:2,本当:1,"来的 ":2,"東西 ":2,样:2,欢:2,歡:2,殺人事件:1,毎日:1,每:2,民主主義:1,気:1,汤:2,沒:2,没有:2,"波士頓 ":2,"波士顿 ":2,海外旅行:1,"游泳 ":2,澳大利亚:2,现:2,生懸命:1,"生活 ":2,的东西:2,的事:2,的人:2,的名字:2,"的問題 ":2,"的国家 ":2,的地方:2,"的城市 ":2,"的女人 ":2,"的想法 ":2,的房子:2,"的房間 ":2,"的故事 ":2,"的照片 ":2,"的話 ":2,"看电视 ":2,看起来:2,"看電視 ":2,県庁所在:1,真的:2,知道:2,私達:1,科学技術:1,第二次世:1,約束:1,经:2,给:2,而:2,自分:1,自動車:1,自己的:2,自己紹介:1,自転車:1,"色的 ":2,行方不明:1,裡:2,西班牙:2,见:2,言葉:1,計画:1,試験:1,誕生日:1,說:2,読む価値:1,话:2,语:2,说:2,请:2,跟:2,车:2,过:2,还:2,这:2,這個:2,運転:1,部屋:1,郵便局:1,"里 ":2,"重要 ":2,重要的:2,間違:1,"问题 ":2,间:2,電話番号:1,音楽:1,飛行機:1,高校時代:1,高速道路:1,麼:2,點:2,가:3,거:3,"건 ":3,"걸 ":3,것:3,게:3,"계속 ":3,고:3,"과 ":3,그:3,기:3,"까 ":3,나:3,난:3,내:3,너:3,"네 ":3,는:3,니:3,다:3,"더 ":3,"데 ":3,도:3,"든 ":3,들:3,라:3,로:3,를:3,리:3,마:3,만:3,말:3,"면 ":3,무:3,보:3,사:3,생각:3,서:3,선생님:3,세:3,수:3,스:3,시:3,신:3,아:3,안:3,않:3,야:3,어:3,없:3,었:3,에:3,여:3,오늘:3,"와 ":3,"왜 ":3,요:3,우:3,으:3,은:3,을:3,의:3,이:3,인:3,일:3,있:3,자:3,"절대 ":3,제:3,"좀 ":3,좋:3,주:3,지:3,"처럼 ":3,컴퓨터:3,"테 ":3,텔레비전:3,톰:3,프랑:3,하:3,한:3,"할 ":3,"함께 ":3,"항상 ":3,해:3,했:3,"히 ":3,𝑥:9,"- ":9,";可俗話":2,"�":9}},O=/([,,、。!¿?!?":;()「」{}„“«»”"“<>⋯《》*]|[.[\]\\])+/,S=/[ ]+/;function J(e){return e.split(S)}function j(e,n,t=!0){let a=[],o=t?" ".repeat(n-1)+e+" ".repeat(n-1):e;for(let e=0;e1)&&t.push(o[e+a]);let r=t.join("");r.trim().length>0&&r.length===n&&a.push(r)}return a}function K(e,n,t,a){for(let o of y){let i=j(e,o);for(let e of i){if(!t.has(e))continue;let i=k(n.uniques[e]);if(!(a.only.length>0)||a.only.includes(i))return a.verbose&&console.log(`[Pass 1] detectUniqueGrams ${o}-grams - match '${e}' to ${i}`),i}}return""}function E(e,n,t){let a=new Map,o=y.map((n=>j(e,n))).flat();t.verbose&&console.log("[Pass 2] DetectPotentialGrams",e,o);let i=new Set([...G.values()].filter((e=>!(t.only.length>0)||t.only.includes(e)||t.only.includes(k(e)))));i.forEach((e=>a.set(e,0)));for(let e of o){let o=F(e),r=n.multiples[o];if(!r)continue;let s=new Set(Object.keys(r)),l=[];for(let e of i)s.has(e)&&(a.set(e,(a.get(e)||0)+r[e]*o.length/4),l.push(`${e} = ${r[e]/1024*100}%`));t.verbose&&l.length>0&&console.log(`Gram '${o}'`,l)}let r=[...a.entries()];r.sort(((e,n)=>n[1]-e[1]));let s=Math.max(...r.map((e=>e[1])))||1,l=r.slice(0,8).map((e=>({lang:k(e[0]),accuracy:1-M((s-e[1])/s),score:M(e[1])})));return t.verbose&&console.log("Result",e,l),l}var z=H,P={uniques:Object.fromEntries(Object.entries(z.uniques).map((e=>[e[0],V[parseInt(e[1].toString(),36)]]))),multiples:Object.fromEntries(Object.entries(z.multiples).map((e=>{let n=Object.fromEntries(e[1].match(/(.{1,3})/g)?.map((e=>{let n=e.slice(0,1),t=e.slice(1);return[V[parseInt(n,36)],parseInt(t,36)]}))||[]);return[e[0],n]})))},x=new Set(Object.keys(H.uniques));function N(e,n){let t=function(e,n){let t=T(n);return function(e){return"string"==typeof e||e instanceof String}(e)?function(e,n,t,a){let o=function(e){return e.split(O)}(e);o=o.map((e=>function(e){return e.toLowerCase().replace(B,"'").replace(h," ").replace(b,(e=>String.fromCharCode(e.charCodeAt(0)-65248))).replace(A,"").replace(f," ").trim()}(e))).filter((e=>!!e)),o.sort(((e,n)=>n.length-e.length)),o=o.slice(0,7),n.verbose&&console.log("Analize chunks",o);let i=0,r={};for(let e of o){let o=K(e,t,a,n);if(o){r[o]=(r[o]||0)+1*e.length,i+=e.length;continue}let s=J(e);for(let e of s)E(e,t,n).forEach((e=>{r[e.lang]=(r[e.lang]||0)+e.accuracy})),i+=e.length}let s=Object.entries(r).filter((e=>e[1]>0));s.sort(((e,n)=>n[1]-e[1]));let l=s.map((e=>({lang:e[0],accuracy:e[1]/i})));return n.verbose&&console.log("Merge Results",l),l}(e,t,P,x):[]}(e,n);return t.length>0?t[0].lang:""}function R(e,n,t,a,o){if(!window.location.hostname.includes("m.youtube.com")){const n=e.getAudioTrack(),t=n?.getLanguageInfo();if("und"!==t?.id)return t.id.split(".")[0]}const i=n?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}return N([t,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").slice(0,250))}function U(){const e=document.querySelector("#movie_player"),n=e.getVideoData(),t=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=n,{shortDescription:s}=t?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:R(e,t,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}var q=t("./src/yandexRequests.js");const Q={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},Y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/"},W={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},Z={log:(...e)=>{},translations:e=>{}};let X=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function _(e){document.querySelector(".translationBtn").style.color=e}function $(e="none"){document.querySelector(".translationBtn").dataset.state=e}function ee(e="none"){let n;switch(e){case"error":n="#7A7A7D";break;case"success":n="#A36EFF";break;default:n="#FFFFFF"}document.querySelector(".translateIcon").style.fill=n}function ne(e="none",n){switch(e){case"error":ee(e),_("#7A7A7D"),$(e);break;case"success":ee(e),_("#A36EFF"),$(e);break;default:ee("none"),_("#FFFFFF"),$("none")}document.querySelector(".translationBtn").innerText=n}function te(e,n,t){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(n),i.htmlFor=e,i.innerHTML=t,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function ae(e,n,t){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=n,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=t,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function oe(e,n){const t=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of n){const n=document.createElement("option");n.innerText=e.label,n.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&n.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(n.disabled=e.disabled),a.appendChild(n)}return t.classList.add("translationMenuContainer"),t.appendChild(a),t}function ie(e){return new Promise((n=>{const t=document.querySelector(e);if(t)return n(t);const a=new MutationObserver((()=>{const t=document.querySelector(e);t&&(n(t),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}X in W||(X="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(n,t){return void 0!==e[t]?e[t]:n}))});const re=e=>new Promise((n=>setTimeout(n,e))),se=e=>{const n=new URL(window.location.href);switch(e){case"youtube":return n.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||n.searchParams.get("v");case"vk":return n.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?n.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):n.searchParams.get("z")?n.searchParams.get("z").split("/")[0]:!(!n.searchParams.get("oid")||!n.searchParams.get("id"))&&`video-${Math.abs(n.searchParams.get("oid"))}_${n.searchParams.get("id")}`;case"9gag":case"gag":return n.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||n.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${n.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${n.searchParams.get("clip")}`}return n.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?n.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:n.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return n.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return n.pathname.match(/[^/]+\/[^/]+$/)?.[0]||n.pathname.match(/[^/]+$/)?.[0];case"xvideos":return n.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return n.searchParams.get("viewkey")||n.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return n.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return n.pathname;case"rutube":return n.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"bilibili.com":const e=n.searchParams.get("bvid");if(e)return e;{let e=n.pathname.match(/video\/([^/]+)/)?.[1];return e&&n.search&&null!==n.searchParams.get("p")&&(e+=`/?p=${n.searchParams.get("p")}`),e}case"mail.ru":if(n.pathname.startsWith("/v/")||n.pathname.startsWith("/mail/"))return n.pathname;default:return!1}};var le=t("./src/config/config.js");const de=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],ue=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],ce=2,me={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},ge={audioProxy:0};function pe(e){return indexedDB.open(e,ce)}async function he(){return new Promise(((e,n)=>{const t=pe("VOT");t.onerror=()=>{console.error(`${W[X].VOTFailedInitDB}: ${t.error.message}`),n(!1)},t.onupgradeneeded=a=>{const o=t.result;if(o.onerror=()=>{const e=W[X].VOTFailedInitDB;alert(e),console.error(e,t.error),n(!1)},a.oldVersion<1){const t=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(me).filter((e=>"key"!==e)))t.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),t.transaction.oncomplete=t=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(me);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),n(!1)}}}a.oldVersion<2&&function(t,a,o,i={}){const r=t.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=t=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),n(!1)},s.onsuccess=()=>{const t=s.result||Object.assign(me,i);for(const e in o)t[e]=o[e];const a=r.put(t);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),n(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(t.transaction,o,ge)},t.onsuccess=()=>{const a=t.result;a.onversionchange=()=>{a.close();const e=W[X].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),n(!1)},e(!0)},t.onblocked=()=>{const e=t.result,a=W[X].VOTDisabledForDBUpdating;console.error(a,e),alert(a),n(!1)}}))}async function Ae({autoTranslate:e,defaultVolume:n,showVideoSlider:t,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof n||"number"==typeof t||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=pe("VOT");d.onerror=()=>{const e=W[X].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await he(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),m=c.get("settings");m.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},m.onsuccess=()=>{const d=m.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof n&&(d.defaultVolume=n),"number"==typeof t&&(d.showVideoSlider=t),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,n=W[X].VOTDisabledForDBUpdating;console.error(n,e),alert(n),l(!1)}}}))}function be(){indexedDB.deleteDatabase("VOT")}function fe(e,n,t,a){let o;return n>a?(o=t+(n-a),o=o>100?100:Math.max(o,0),e.volume=o/100):n100?100:Math.max(o,0),e.volume=o/100),o}const Be={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},Ie=".html5-video-container",Fe=".video-ref",De="main > div > section > div > div > div",ve=".shaka-video-container",ye=".videoplayer_media",Le='div[data-testid="videoComponent"] > div:nth-child(1) > div',Me=".player",Te=".video-post",Ce=".bpx-player-video-wrap",Ge="#b-video-wrapper",we=[...de,...ue];(async function(){Z.log("Loading extension..."),Z.log(`Selected menu language: ${X}`);const e=(await Promise.resolve().then(t.bind(t,"./src/rvt.js"))).default;if(Z.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=W[X].unSupportedExtensionError;return console.error(e),alert(e)}let n;Z.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(n),r(1),n=setTimeout((()=>{r(0)}),2e3)}function l(e,n,t){clearTimeout(n),r(t),e.stopPropagation()}async function d(t,d,u){let c,m,g,p,h,A,b,f,B,I,F,D;Z.log("[translateProccessor] execute on element: ",t);let v,y=!0;Z.log("videoContainer",t),c="vimeo"===d?t.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):t.querySelector("video"),Z.log("video",c);let L=function(){const e={};if(e.duration=c?.duration||0,e.videoId=se(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")){let n=U();n=G(n,n.detectedLanguage),e.detectedLanguage=n.detectedLanguage,e.responseLanguage=n.responseLanguage}else window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh");return e}();console.log("VOT Video Data: ",L);const M="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):t;!function(e){if(!e||e.querySelector(".translationBlock"))return;const n=document.createElement("div");n.classList.add("translationBlock"),n.innerHTML=`\n \n \n \n \n \n \n ${W[X].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(n),Z.log("VOT: Added translation button to ",e)}(M),function(e){if(e.querySelector(".translationMenuContent"))return;const n=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${W[X].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(n),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const n=document.querySelector(".translationMenuContent");n.style.display=i?"none":"block",n.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),be(),location.reload()})),Z.log("VOT: Added translation menu to ",e)}(M);try{v=await he()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const T=document.querySelector(".translationMenuOptions");if(T&&!T.querySelector("#VOTTranslateFromLang")){const e=[{label:W[X].videoLanguage,value:"default",disabled:!0},...Object.entries(Q).map((([e,n])=>({label:W[X][n],value:e,selected:L.detectedLanguage===e})))],n=[{label:W[X].translationLanguage,value:"default",disabled:!0},...Object.entries(Q).map((([e,n])=>({label:W[X][n],value:e,selected:L.responseLanguage===e})))],t=oe("VOTTranslateFromLang",e),a=oe("VOTTranslateToLang",n).firstElementChild;t.id="VOTSelectLanguages",t.innerHTML+='\n \n \n \n ',t.appendChild(a),T.appendChild(t),T.querySelector("#VOTTranslateFromLang").addEventListener("change",(e=>{Z.log("[onchange] select from language",e.target.value),L=G(L,e.target.value)})),T.querySelector("#VOTTranslateToLang").addEventListener("change",(e=>{Z.log("[onchange] select to language",e.target.value),L=w(L,e.target.value)}))}if(v){const e=await async function(){return new Promise(((e,n)=>{const t=pe("VOT");t.onerror=()=>{const e=W[X].VOTFailedReadFromDB;alert(e),console.error(e,t.error.message),n(!1)},t.onupgradeneeded=async()=>{t.result.close(),await he(),e(!0)},t.onsuccess=()=>{const a=t.result;a.onversionchange=()=>{a.close();const e=W[X].VOTDBNeedUpdate;alert(e),console.error(e),n(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(W[X].VOTFailedReadFromDB,e.error),console.error(e),n(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),be(),n(!1));const t=o.result;e(t)}},t.onblocked=()=>{const e=t.result,a=W[X].VOTDisabledForDBUpdating;console.error(a,e),alert(a),n(!1)}}))}();if(e){if(A=e.autoTranslate,b=e.defaultVolume,f=e.showVideoSlider,B=e.autoSetVolumeYandexStyle,I=e.dontTranslateYourLang,D=e.audioProxy,F=e.syncVolume,Z.log("[db] data from db: ",e),void 0!==A&&T&&!T.querySelector("#VOTAutoTranslate")){const e=te("VOTAutoTranslate",A,W[X].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${W[X].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const n=Number(e.target.checked);await Ae({autoTranslate:n}),A=n,Z.log("autoTranslate value changed. New value: ",A)},T.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==I&&T&&!T.querySelector("#VOTDontTranslateYourLang")){const e=te("VOTDontTranslateYourLang",I,W[X].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const n=Number(e.target.checked);await Ae({dontTranslateYourLang:n}),I=n,Z.log("dontTranslateYourLang value changed. New value: ",I)},T.appendChild(e)}if(void 0!==B&&T&&!T.querySelector("#VOTAutoSetVolume")){const e=te("VOTAutoSetVolume",B,W[X].VOTAutoSetVolume+(100*le.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const n=Number(e.target.checked);await Ae({autoSetVolumeYandexStyle:n}),B=n,Z.log("autoSetVolumeYandexStyle value changed. New value: ",B)},T.appendChild(e)}if(void 0!==f&&T&&!T.querySelector("#VOTShowVideoSlider")){const e=te("VOTShowVideoSlider",f,W[X].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const n=Number(e.target.checked);await Ae({showVideoSlider:n}),f=n,Z.log("showVideoSlider value changed. New value: ",f),1===f&&"success"===document.querySelector(".translationBtn").dataset.state?O():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},T.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==F&&T&&!T.querySelector("#VOTSyncVolume")){const e=te("VOTSyncVolume",F,W[X].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const n=Number(e.target.checked);await Ae({syncVolume:n}),F=n,Z.log("syncVolume value changed. New value: ",F)},T.appendChild(e)}}}function C(e,n=X){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${n}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=n)}function G(e,n){switch(n){case"en":e.detectedLanguage=n,e.responseLanguage=X;break;case"ru":e.detectedLanguage=n,e.responseLanguage=X,"ru"==X&&(e.responseLanguage="en");break;default:if(!Object.keys(Q).includes(n))return G(e,"en");e.detectedLanguage=n}return C(e.detectedLanguage,e.responseLanguage),e}function w(e,n){if("en"===n)e.responseLanguage=n,e.detectedLanguage="ru";else{if(!Object.keys(Q).includes(n))return w(e,"ru");e.detectedLanguage&&e.responseLanguage===X&&(e.detectedLanguage="en"),e.responseLanguage=n}return C(e.detectedLanguage,e.responseLanguage),e}function V(){a.pause(),c.removeEventListener(".translate",V,!1),a.src="",a.removeAttribute("src"),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",ne("none",W[X].translateVideo),g&&(c.volume=g)}function k(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),n=document.querySelector("#VOTVideoSlider");if(!n)return;n.value=e;const t=document.querySelector("#VOTVideoVolume");t&&(t.innerText=`${e}%`),1===F&&(p=Number(e))}ne("none",W[X].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&k()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const H=(e=!1)=>{if(Z.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(Z.log("lipsync mode is pause"),a.pause()),"stop"===e&&(Z.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(Z.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(Z.log("lipsync mode is playing"),a.play()),"abort"===e&&(Z.log("lipsync mode is abort"),a.pause());else{Z.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=W[X].grantPermissionToAutoPlay;throw ne("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=we.includes(window.location.hostname)?W[X].neededAdditionalExtension:W[X].audioFormatNotSupported;throw ne("error",e),`VOT: ${e}`}}))}else Z.log("lipsync mode is not set")};function O(){if(1!==f||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!B?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);p=e;const n=ae("VOTVideoSlider",e,`${W[X].VOTVolume}: ${e}%`);n.querySelector("#VOTVideoSlider").oninput=e=>{const{value:t}=e.target;if(c.volume=t/100,n.querySelector("#VOTOriginalVolume").innerText=`${t}%`,1!==F)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=fe(a,t,i,p);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),h=r,p=t},document.querySelector(".translationMenuOptions").appendChild(n)}const S=e=>{Z.log("Run videoValidator"),function(){if(window.location.hostname.includes("youtube.com")){let e=U();if(e=G(e,e.detectedLanguage),Z.log("VideoValidator videoData: ",L),1===I&&e.detectedLanguage===X)throw y=!1,W[X].VOTDisableFromYourLang;if(e.isLive)throw W[X].VOTLiveNotSupported;if(e.isPremiere)throw W[X].VOTPremiere;if(L.duration>14400)throw W[X].VOTVideoIsTooLong}}(),Z.log("Run translateFunc"),K(e,L.detectedLanguage,L.responseLanguage)};function J(e){Z.log(`video ${e.type}`),H(e.type)}function j(){V(),k()}function K(n,o,i){!function(n,t,a,o,i){Z.log(`Translate video (url: ${n}, unknown1: ${t}, requestLang: ${a}, responseLang: ${o})`),e(n,t,a,o,((e,n)=>{if(Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,W[X].requestTranslationFailed);const t=q.G.decodeResponse(n);switch(console.log("VOT Response: ",t),t.status){case 0:i(!1,t.message);break;case 1:i(!!t.url,t.url||W[X].audioNotReceived);break;case 2:i(!1,t.remainingTime?function(e){const n=Math.floor(e/60),t=Math.floor(e%60);return n>=60?W[X].translationTakeMoreThanHour:n>=10&&n%10?W[X].translationTakeApproximatelyMinutes.format(n):1==n||0==n&&t>0?W[X].translationTakeAboutMinute:W[X].translationTakeApproximatelyMinute.format(n)}(t.remainingTime):W[X].translationTakeFewMinutes);break;case 3:i(!1,W[X].videoBeingTranslated)}}))}(`${Y[d]}${n}`,0x4075500000000000,o,i,(async(e,r)=>{if(Z.log("[exec callback] translateVideo"),se(d)!==n)return;if(!e)throw ne("error",r),r.includes(W[X].translationTake)&&(clearTimeout(m),m=setTimeout((()=>K(n,o,i)),6e4)),r;switch(a.src=r,g=c?.volume,"number"==typeof b&&(a.volume=b/100),"number"==typeof B&&B&&(c.volume=le.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",j);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,j)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(j(),y=!0)}))})).observe(t,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&H("play");const l=document.querySelectorAll("video"),A=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>A.forEach((n=>e.addEventListener(n,J))))),ne("success",W[X].disableTranslate),O(),function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof b?b:100;p=e;const n=ae("VOTTranslationSlider",e,`${W[X].VOTVolumeTranslation}: ${e}%`);n.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await Ae({defaultVolume:Number(e)}),b=Number(e),1===F&&function(e){const n=document.querySelector("#VOTVideoSlider");if(!n)return;const t=Number(n.value),a=fe(c,e,t,h);n.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),p=a,h=e}(e)},document.querySelector(".translationMenuOptions").appendChild(n)}();const f=document.querySelector("#VOTVideoSlider");f&&(f.value=100*le.IM);const I=document.querySelector("#VOTOriginalVolume");I&&(I.innerText=100*le.IM+"%");const D=document.querySelector(".translationDownload");D.href=r,D.style.display="initial"}))}document.addEventListener("click",(e=>{const n=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!n&&e.target!==n)&&n.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!t&&e.target!==t)&&t.contains(e.target);Z.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const E=(e,n,t)=>{n.forEach((n=>e.addEventListener(n,t)))};"pornhub"===d?window.location.pathname.includes("view_video.php")?E(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&E(document.querySelector("#player"),["mousemove","mouseout"],s):E("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):t,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,n,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,n,o))),document.addEventListener("touchstart",(e=>l(e,n,o))),document.addEventListener("touchmove",(e=>l(e,n,o))),document.addEventListener("touchend",(e=>l(e,n,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return Z.log("[click translationBtn] audio.src is not empty"),void V();try{Z.log("[click translationBtn] trying execute translation");const e=se(d);if(!e)throw W[X].VOTNoVideoIDFound;S(e)}catch(e){ne("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(e=>{if(e.stopPropagation(),!y||1!==A)return;const n=se(d);if(!n)throw W[X].VOTNoVideoIDFound;try{S(n),y=!1}catch(e){ne("error",String(e).substring(4,e.length)),y=!1}}))}await async function(){if(Z.log("Runned initWebsite function"),Be.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(Ie);if(e)Z.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const n=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",n),document.addEventListener("yt-navigate-start",n),window.location.hostname.includes("m.youtube.com")){let e=await ie("#player");e&&(await re(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async n=>{for(const t of n)"attributes"===t.type&&"src"===t.attributeName&&(e=await ie("#player"),await re(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const n=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",n),document.addEventListener("yt-navigate-finish",n),document.addEventListener("spfrequest",n),document.addEventListener("yt-navigate-start",n)}}else if(window.location.hostname.includes("twitch.tv")){if(Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(Z.log("[initWebsite] Matched Twitch Mobile"),await ie(De)){await re(200);const e=document.querySelector(De);await d(e,"twitch",null),new MutationObserver((async n=>{for(const t of n)"attributes"===t.type&&"src"===t.attributeName&&t.target===e?.querySelector("video")&&(await re(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){Z.log("[initWebsite] Matched Twitch Desktop");const e=await ie(Fe);e&&(await re(200),await d(e,"twitch",null))}Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return Z.log("[entered] xvideos"),await re(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return Z.log("[entered] pornhub"),await re(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(de.includes(window.location.hostname))Z.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(ue.includes(window.location.hostname)){Z.log("[entered] piped");const e=await ie(ve);if(e){let n,t=se("youtube");await d(e,"youtube","piped"),setInterval((async()=>{n=se("youtube"),t!==n&&(n&&await d(document.querySelector(ve),"youtube","piped"),t=n)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(Z.log("[entered] vk.com"),await ie(ye)){let e;await d(document.querySelector(ye),"vk",null);let n=se("vk");setInterval((async()=>{if(e=se("vk"),n!==e){if(e){const e=await ie(ye);e&&await d(e,"vk",null)}n=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))Z.log("[entered] vimeo.com"),await ie(Me)&&(await re(1e3),await d(document.querySelector(Me),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await re(1e3),await d(document.querySelector(Te),"9gag",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",n=await ie(e);n&&await d(n,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await ie(Ce);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await ie("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await ie(Le);if(e){let n,t=se("twitter");await d(e,"twitter",null),setInterval((async()=>{n=se("twitter"),t!==n&&(n&&await d(document.querySelector(Le),"twitter",null),t=n)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await ie(Ge);if(e){let n,t=se("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{n=se("mail.ru"),t!==n&&(n&&await d(document.querySelector(Ge),"mail.ru",null),t=n)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>a,IM:()=>r,Rr:()=>i,iF:()=>o});const o="api.browser.yandex.ru",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var a=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=o(!0),d=a.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},b={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},y={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function k(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function L(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function F(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in y||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${y[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=y[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(B);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,z)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=y[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=y[V].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=y[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=y[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=y[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${y[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${y[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:y[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:y[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:y[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:y[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),o=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(e=>{f.log("[onchange] select from language",e.target.value),_=G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(e=>{f.log("[onchange] select to language",e.target.value),_=W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=y[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=y[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(y[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),j(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=y[V].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=x("VOTAutoTranslate",O,y[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${y[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=x("VOTDontTranslateYourLang",E,y[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=x("VOTAutoSetVolume",M,y[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=x("VOTShowVideoSlider",D,y[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=x("VOTSyncVolume",I,y[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}function Y(e,t=V){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t)}function G(e,t){switch(t){case"en":e.detectedLanguage=t,e.responseLanguage=V;break;case"ru":e.detectedLanguage=t,e.responseLanguage=V,"ru"==V&&(e.responseLanguage="en");break;default:if(!Object.keys(v).includes(t))return G(e,"en");e.detectedLanguage=t}return Y(e.detectedLanguage,e.responseLanguage),e}function W(e,t){if("en"===t)e.responseLanguage=t,e.detectedLanguage="ru";else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return Y(e.detectedLanguage,e.responseLanguage),e}function Z(){o.pause(),c.removeEventListener(".translate",Z,!1),o.src="",o.removeAttribute("src"),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",k("none",y[V].translateVideo),m&&(c.volume=m)}function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}k("none",y[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=(e=!1)=>{if(f.log("lipsync video",c),c)if(o.currentTime=c.currentTime,o.playbackRate=c.playbackRate,e)if("play"!==e)f.log(`lipsync mode is ${e}`),o.pause(),"playing"===e&&(f.log("lipsync mode is playing"),o.play());else{f.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=y[V].grantPermissionToAutoPlay;throw k("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?y[V].neededAdditionalExtension:y[V].audioFormatNotSupported;throw k("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${y[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=$(o,n,i,g);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(te=G(te,te.detectedLanguage),f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V)throw z=!1,y[V].VOTDisableFromYourLang;if(te.isLive)throw y[V].VOTLiveNotSupported;if(te.isPremiere)throw y[V].VOTPremiere;if(_.duration>14400)throw y[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await ae(e,_.detectedLanguage,_.responseLanguage)};function ne(e){f.log(`video ${e.type}`),J(e.type)}function oe(){Z(),K()}function ae(t,a,i){!function(t,n,o,a,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),e(t,n,o,a,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,y[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||y[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?y[V].translationTakeMoreThanHour:t>=10&&t%10?y[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?y[V].translationTakeAboutMinute:y[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):y[V].translationTakeFewMinutes);break;case 3:i(!1,y[V].videoBeingTranslated)}}))}(`${b[d]}${t}`,0x4075500000000000,a,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw k("error",r),r.includes(y[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>ae(t,a,i)),6e4)),r;switch(o.src=r,m=c?.volume,"number"==typeof S&&(o.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(oe(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),k("success",y[V].disableTranslate),X(),function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${y[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=$(c,e,n,w);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),g=o,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const b=document.querySelector(".translationDownload");b.href=r,b.style.display="initial"}))}document.addEventListener("click",(e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${a} ${s} ${l}`),a||s||(l||r(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,n)))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,a))),document.addEventListener("touchstart",(e=>l(e,t,a))),document.addEventListener("touchmove",(e=>l(e,t,a))),document.addEventListener("touchend",(e=>l(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return f.log("[click translationBtn] audio.src is not empty"),void Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw y[V].VOTNoVideoIDFound;await Q(e)}catch(e){k("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw y[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){k("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot.user.js b/dist/vot.user.js index 509ff022..2c52f315 100644 --- a/dist/vot.user.js +++ b/dist/vot.user.js @@ -13,7 +13,7 @@ // @description:it Una piccola estensione che aggiunge la traduzione vocale del video dal browser Yandex ad altri browser // @description:ru Небольшое расширение, которое добавляет закадровый перевод видео из Яндекс Браузера в другие браузеры // @description:zh 一个小扩展,它增加了视频从Yandex浏览器到其他浏览器的画外音翻译 -// @version 1.3.3 +// @version 1.3.4-testing // @author sodapng, mynovelhost, Toil, SashaXser // @supportURL https://github.com/ilyhalight/voice-over-translation/issues // @match *://*.youtube.com/* @@ -854,6 +854,7 @@ const VideoTranslationRequest = new protobuf.Type("VideoTranslationRequest") .add(new protobuf.Field("language", 8, "string")) // source language code .add(new protobuf.Field("unknown3", 9, "int32")) // 0 0 .add(new protobuf.Field("unknown4", 10, "int32")) // 0 0 + .add(new protobuf.Field("translationHelp", 11, "int32")) // array for translation assistance ([0] -> {2: link to video, 1: "video_file_url"}, [1] -> {2: link to subtitles, 1: "subtitles_file_url"}) .add(new protobuf.Field("responseLanguage", 14, "string")); // target language code // const VideoWhitelistStreamRequest = new protobuf.Type("VideoWhitelistStreamRequest") @@ -1071,25 +1072,24 @@ var update = injectStylesIntoStyleTag_default()(main/* default */.Z, options); /* harmony default export */ const styles_main = (main/* default */.Z && main/* default */.Z.locals ? main/* default */.Z.locals : undefined); -;// CONCATENATED MODULE: ./node_modules/tinyld/dist/tinyld.light.node.mjs -var D={TINYLD_CONFIG:"light"};var v=/[,.。,、#%&/\\+*¡!¿?[\]!?;:…„“«»”"“_–—~]/gi,S=/[0-9]/g,P=/[\uFF10-\uFF19]/g,N=/\s\s+/g,O=/’/gi,w=/[\u0300-\u036f]/g;function b(e){return typeof e=="string"||e instanceof String}function M(e){return e.toLowerCase().replace(O,"'").replace(v," ").replace(P,n=>String.fromCharCode(n.charCodeAt(0)-65248)).replace(S,"").replace(N," ").trim()}function j(e){return e.normalize("NFD").replace(w,"")}var C={light:{TRAINING_UNIQUE_GRAMS:[1,2,3,4],TOP_LANGUAGE_UNIQUE_GRAMS:60,TOP_LANGUAGE_STATS_GRAMS:50},normal:{TRAINING_UNIQUE_GRAMS:[1,2,3,4,5],TOP_LANGUAGE_UNIQUE_GRAMS:100,TOP_LANGUAGE_STATS_GRAMS:180},heavy:{TRAINING_UNIQUE_GRAMS:[1,2,3,4,5],TOP_LANGUAGE_UNIQUE_GRAMS:320,TOP_LANGUAGE_STATS_GRAMS:1024}},g=D.TINYLD_CONFIG||"normal",L=C[g].TRAINING_UNIQUE_GRAMS,o0=C[g].TOP_LANGUAGE_UNIQUE_GRAMS,t0=C[g].TOP_LANGUAGE_STATS_GRAMS,K=1e4;function d(e){return Math.round(e*K)/K}var k=e=>{let n={only:[],verbose:!1};return e?Object.assign(n,e):n},c={afr:{code:"af",region:"africa",name:"Afrikaans",skipLight:!0},amh:{code:"am",region:"africa",name:"Amharic",skipLight:!0,coefProb:0},ber:{code:"ber",region:"africa",name:"Berber",skipLight:!0,coefProb:.25},run:{code:"rn",region:"africa",name:"Kirundi",skipLight:!0},jpn:{code:"ja",region:"asia-east",name:"Japanese",alias:["jp"],coefProb:0},cmn:{code:"zh",region:"asia-east",name:"Chinese",alias:["cn"],coefProb:.25},kor:{code:"ko",region:"asia-east",name:"Korean",alias:["kr"],coefProb:0},mya:{code:"my",region:"asia",name:"Burmese",skipLight:!0,coefProb:0},tha:{code:"th",region:"asia",name:"Thai",coefProb:0},vie:{code:"vi",region:"asia",name:"Vietnamese",skipLight:!0,coefProb:0},ind:{code:"id",region:"asia",name:"Indonesian",skipLight:!0},khm:{code:"km",region:"asia",name:"Khmer",skipLight:!0,coefProb:0},tgl:{code:"tl",region:"asia",name:"Tagalog",skipLight:!0},ben:{code:"bn",region:"asia-south",name:"Bengali",coefProb:0},tam:{code:"ta",region:"asia-south",name:"Tamil",skipLight:!0,coefProb:0},hin:{code:"hi",region:"asia-south",name:"Hindi",coefProb:0},urd:{code:"ur",region:"asia-south",name:"Urdu",skipLight:!0,coefProb:0},guj:{code:"gu",region:"asia-south",name:"Gujarati",skipLight:!0,coefProb:0},kan:{code:"kn",region:"asia-south",name:"Kannada",skipLight:!0,coefProb:0},tel:{code:"te",region:"asia-south",name:"Telugu",skipLight:!0,coefProb:0},fra:{code:"fr",region:"europe-west",name:"French"},eng:{code:"en",region:"europe-west",name:"English",alias:["us","gb"]},deu:{code:"de",region:"europe-west",name:"German",coefProb:.5},spa:{code:"es",region:"europe-west",name:"Spanish"},por:{code:"pt",region:"europe-west",name:"Portuguese",alias:["po"]},ita:{code:"it",region:"europe-west",name:"Italian"},nld:{code:"nl",region:"europe-west",name:"Dutch"},gle:{code:"ga",region:"europe-west",name:"Irish",skipLight:!0},lat:{code:"la",region:"europe",name:"Latin",skipLight:!0},ces:{code:"cs",region:"europe",name:"Czech",skipLight:!0},srp:{code:"sr",region:"europe",name:"Serbian",skipLight:!0},ell:{code:"el",region:"europe",name:"Greek",alias:["gr"],coefProb:0},mkd:{code:"mk",region:"europe",name:"Macedonian",skipLight:!0,coefProb:1.5},slk:{code:"sk",region:"europe",name:"Slovak",skipLight:!0},dan:{code:"da",region:"europe-north",name:"Danish",skipLight:!0,coefProb:1.5},swe:{code:"sv",region:"europe-north",name:"Swedish"},fin:{code:"fi",region:"europe-north",name:"Finnish"},nob:{code:"no",region:"europe-north",name:"Norwegian",coefProb:1.5},isl:{code:"is",region:"europe-north",name:"Icelandic",skipLight:!0,coefProb:.5},hun:{code:"hu",region:"europe-east",name:"Hungarian"},ron:{code:"ro",region:"europe-east",name:"Romanian",coefProb:.5},bul:{code:"bg",region:"europe-east",name:"Bulgarian",skipLight:!0},bel:{code:"be",region:"europe-east",name:"Belarusian",skipLight:!0},rus:{code:"ru",region:"europe-east",name:"Russian"},ukr:{code:"uk",region:"europe-east",name:"Ukrainian",skipLight:!0},pol:{code:"pl",region:"europe-east",name:"Polish",coefProb:.5},lit:{code:"lt",region:"europe-east",name:"Lithuanian",skipLight:!0},est:{code:"et",region:"europe-east",name:"Estonian",skipLight:!0},lvs:{code:"lv",region:"europe-east",name:"Latvian",skipLight:!0},hye:{code:"hy",region:"middle-east",name:"Armenian",skipLight:!0,coefProb:0},tur:{code:"tr",region:"middle-east",name:"Turkish"},heb:{code:"he",region:"middle-east",name:"Hebrew",coefProb:0},yid:{code:"yi",region:"middle-east",name:"Yiddish",skipLight:!0,coefProb:.5},ara:{code:"ar",region:"middle-east",name:"Arabic",coefProb:0},pes:{code:"fa",region:"middle-east",name:"Persian",skipLight:!0,coefProb:0},tat:{code:"tt",region:"middle-east",name:"Tatar",skipLight:!0,coefProb:0},kaz:{code:"kk",region:"middle-east",name:"Kazakh",skipLight:!0},mon:{code:"mn",region:"middle-east",name:"Mongolian",skipLight:!0},tuk:{code:"tk",region:"middle-east",name:"Turkmen",skipLight:!0},epo:{code:"eo",region:"other",name:"Esperanto",skipLight:!0,coefProb:.5},vol:{code:"vo",region:"other",name:"Volapuk",skipLight:!0,coefProb:.5},tlh:{code:"tlh",region:"other",name:"Klingon",skipLight:!0,coefProb:.25}},H=new Set(Object.entries(c).filter(e=>g==="heavy"||g==="normal"||g==="light"&&!e[1].skipLight).map(e=>e[0])),h=[...H.values()],a0=Object.fromEntries(h.map((e,n)=>[e,n+1])),J=Object.fromEntries(h.map((e,n)=>[n+1,e]));function R(e){return e in c?c[e].region:""}function Q(e){return e in c?c[e].name:""}function U(e){let n=Object.entries(c).find(t=>t[1].code===e);if(n)return n[1].code;let o=Object.entries(c).find(t=>t[1].alias&&t[1].alias.includes(e));return o?o[1].code:""}function F(e){return e in c?c[e].code:e}function T(e){let n=Object.entries(c).find(t=>t[1].code===e);if(n)return n[0];let o=Object.entries(c).find(t=>t[1].alias&&t[1].alias.includes(e));return o?o[0]:""}var f={id:"tinyld-dict",multiples:{" '":"D07M0B"," aa":"B02D34G13"," aan":"DA9"," ac":"72F812907A3YB7VC1GD0GF06JEKM0U"," ace":"A18B0SJEKM0B"," ai":"73F809A08B21C2DG61J7AM0U"," all":"74J83H94XA11C6PD5QF6ZG0UH68I04M0C"," am ":"80U91WJG6"," are":"86UA04B05C0IJ5WL04"," at ":"84LA02D08H93M05"," att":"72K80Q902C1MFKTH04I0FM0D"," av ":"F5YHAJ"," az":"A0CB0BC06IJAJ0LL02M12"," az ":"IS8M0T"," be ":"87GF0AI31"," bir":"80EC11I09J0RMRC"," bli":"80490KD2AF2SH5IL0A"," bu ":"707MD7"," bun":"802903H05I03J4LM8V"," by":"81MF0RH0QL8N"," był":"L86"," c'":"75MC1N"," ce ":"7C9C0EJEM"," che":"74080T907A05B2KCO5D04F05J1JL02"," ci":"71580DA2XB2KC6ID02F04I0LJ5UL5OM0S"," com":"7BX83Z907ACUBKZCASD0UJ45"," con":"7A482ZAITBCQCFLD13J80"," cos":"704808A29B0SCIXJ0N"," cs":"I84"," csa":"IAK"," cu":"70V80LA8EB2DC22D02I07JGCL0AM09"," cu ":"JFJ"," cz":"LBQ"," czy":"L8V"," câ":"B08J84"," că":"JF8"," că ":"JIJ"," d'":"78TB02C0T"," da ":"91KA0LB7UC6LH1OJ0UL07M1L"," das":"9JRA03B1MD02"," dat":"70480A903A04B03C18DK0F0EH0SJ3EL02"," de ":"7SGASGBQWDRVF6KH7JI5FJSGM2H"," deg":"702803C0XD08H7UJ0D"," değ":"M9Z"," di ":"A09CPSH04"," did":"881"," die":"70M80N9LQA16B02C0XD67J05L03"," dig":"704802A0OB0WC05F6Y"," do ":"8BRB9QC02LAM"," don":"73E86X903A0UB05C0SD0DM08"," dov":"C8DJ0C"," du ":"77Q9CNFK1HM3"," dzi":"L83"," dé":"76IA0DB03I0A"," dü":"904I04M86"," e ":"A08BAPC5BI02J6I"," ee":"D9C"," een":"DP5"," egy":"803D03F02G02IQ2"," ei ":"902B02D02GHXH09J61"," ein":"9NHD0O"," el ":"APOI82JBXM08"," ela":"B8PI0Q"," ell":"7BLA8QD03F1QG06H27I2CM0D"," em ":"BB7"," en ":"7D2AM9D9FFH6GBVHJIM2Q"," er ":"9AWD8MF24HSCM02"," era":"A2YB2TC8VD09F09J6I"," es ":"71L9C0AKI"," est":"7KG803AQJBPDC10D02G09I1KJPIM03"," et ":"7ANG2PH8AM0I"," ett":"F7BGDGH32I0TM3Y"," eu ":"716BLEJ43"," ez":"IAFJ03M05"," ez ":"IE3"," fai":"7D780FC0FJ07"," faz":"B7KM1Y"," fö":"FF1I0R"," för":"FI0"," fø":"H23"," ger":"702809933A03B0JC0ND0ZF0DI03J0OM97"," gj":"F1OH3T"," gjø":"H5G"," gy":"F03I4G"," gå":"F4SH2D"," gö":"F41I05MAO"," gör":"F57I0AM8D"," ha ":"A3PCFSF2XH3CI7B"," hab":"70Z80399WA8PB08I05M0K"," hav":"87ZB0XD02F07G05H0EI0GM1C"," he ":"8C6A2JG40"," heb":"903A02B02DH2"," hee":"DD1"," her":"70287O92HA2FB06D1CF08G22H2ZI08L0DM71"," het":"DQKF0PG1IH0DI0I"," hij":"A1HDFL"," his":"70G86WA0QB0OF0DG0AH0MI25L0MM1D"," hj":"F25H1S"," ho ":"C9Y"," hog":"A04D07INN"," hon":"70H808902A0CB0BD25FC8G03I0KL02"," hun":"80J915A03D1DF1XG03HBCI03"," hv":"H8E"," hva":"H6S"," hvo":"H89"," hä":"910F9RGGY"," hän":"90GF1SGOM"," här":"FA7G03"," i'":"844"," ic":"71E8049BTF02L0JM02"," ich":"9NPL0S"," ih":"94PF0JG2SM1R"," ik":"DCMF05G1FHAKI02M29"," ik ":"DSG"," ikk":"G0KHMB"," il ":"7JVCKY"," in ":"8CU9AMCP2DGHF1CJ0A"," io":"B02C89J03"," io ":"CCM"," is ":"8FTDQJF03H05I9O"," iss":"80490AB8F"," ist":"9IXB1WC07F05G1AI0YJ0EL0CMBN"," it ":"881"," iç":"MBC"," içi":"MBB"," j'":"78W"," j'a":"7BH"," ja ":"90QD0EF0CGBYH0II05L1B"," jag":"903D02FSG"," jak":"G0DH06L8G"," je ":"7QE90EDN0L0L"," jeg":"HSGI0KL2P"," jes":"805A03B03F02LN0"," kel":"903D03G1EIBSL02M0I"," kj":"F02H2C"," kn":"849906D07F0OH09"," kno":"86F904D07"," kom":"92YD43F8KG0KH6UI0XL18M10"," kä":"906F2EG65"," ké":"I6F"," kö":"91CF2BG0AI5TM2K"," l'":"7D8C6R"," l'a":"7ACC3S"," le ":"7O2A71CBKF02I2MJ1E"," les":"7HW80990JA13B03C03D0CG02H1QI4GL03"," ll":"A5B"," lo ":"ABKC6EH06"," los":"80S90CADJD09L03"," lä":"90IF5MG3Y"," mai":"77L808903B85C3YG1PI0AJDX"," me ":"77J874ADPB7JC3TD7MG38"," meg":"C14HB1IQXL02"," mi ":"A8LCB4H06I5SJ0NL59M56"," mig":"70680XA02C17F9TI02L02"," mij":"DD6J0BL02"," mit":"70697SA07B02C02F22GC7H1JI5T"," moe":"B04D9J"," mui":"B8ED05G24"," my":"703838F2WG26H19L2C"," má":"A54B0GI66"," már":"IAZ"," må":"F4UH2G"," mé":"71AA0FB0MI4I"," n'":"79SC03"," na ":"903B6QD0VI0NLEF"," nag":"70J902D05F03IA3L0J"," ne ":"7JPC21G1QI6OJ2ZM8Q"," nek":"H06ID2"," nem":"B13C0HD0NISFJ06M02"," nie":"70292PA0HC1HDN2G03LQT"," no ":"826APLB77C0NG0LL06"," noe":"D0AH7AM09"," non":"718806CSG"," nou":"7DUD09G11J2Q"," nu ":"702D2AF2PJS4"," nã":"BLO"," não":"BOG"," nä":"90DF3PG5K"," nå":"F4NH2C"," oc":"70K807A19B0UC10D03F6ZJ1PL12M02"," och":"A0AD08F8NJ10L0D"," of ":"8CFD2K"," og":"C21D06F03H6LL15"," og ":"HEI"," old":"80XI0QMA0"," ole":"GNML02"," oli":"A02C03D07F0AGFEI02L02"," om ":"D7WF8ZH6JJ0Z"," on ":"73X860GSGL58M0P"," onu":"MD6"," op ":"DB4"," opp":"705807C05D04G18H5B"," os ":"702A0OB8L"," ov":"80QA03B0BC06D1EF06G3KH1N"," pe ":"JF5"," pou":"7G1804B1R"," pow":"808L89"," prz":"LGN"," pue":"A97"," på":"FCSH7H"," på ":"FG6HGP"," q":"76F80H903ABABB7C5I"," qu":"7OD80Z905AQPBSGCIB"," qu'":"7A1"," qua":"73L806906B9SCCM"," que":"7O880L903ARRBSGCFQ"," qui":"78480ZA93B1CC3J"," qué":"A7V"," sch":"7028159FXC0ND6WF0BI03J1HL0C"," se ":"76NAEWBA7C3FF17GC2H1YI0XJA1"," she":"888G02"," si ":"74TA4NB0CC8DH1DJ05"," sie":"7069G7A3MC2KG1QH1FI0FL1C"," się":"LJL"," ska":"802F50G03H5AL0D"," sl":"80PC07D12F2VH1NJ0WM04"," sn":"809D0MF24H2AL04"," som":"72583U90AA0UB0WC0FD0OF7CG02HATJ0E"," son":"7B780K91JA4MB0SCFPF0HI02M4O"," su ":"704A8VC1AM0H"," sun":"80FG0UH07JFLM05"," sz":"IHAL53"," sze":"IGNL0N"," sä":"906F3ZG1V"," så":"F59H2X"," så ":"F4OH6M"," sö":"F0UG0LI0HMAA"," söy":"MAI"," să":"JPO"," să ":"JSD"," te ":"74FA7DB2VC1UDF0F0EG25H08I5SJ7ZL0W"," tha":"8LQC02D02"," the":"8SG90DD0L"," thi":"8CJ"," tie":"70J80490IAA4C05D0NG8XI04"," til":"803FB5G13HHKI09"," to ":"8QRH1NLG5"," tod":"81890DA8UB58G3Y"," tou":"7CB80C902D02G03"," tu ":"7CQ903A42B0XC3MJ2BL1V"," tud":"B23IFT"," tul":"704G9PH09I0D"," tä":"904F1BGDN"," um":"80291PBK5C08G02H05J0NL18M1D"," um ":"938BFJ"," uma":"902BBTC07J09L07M0F"," un ":"7GWAHNCGSJF1"," una":"804907AD8CB2I0CJ0T"," une":"7D5804908G0JJ15"," vad":"C3TD1AF6WI0OJ0C"," vag":"704A04B03C02IDR"," van":"704803A0JB03C3IDIJF0TG37H3AIHT"," ve ":"A0GC05M8F"," vi ":"A0KB0MC2HF9WH97"," vil":"715805A02B03C05F8TG0KH9OI28"," voc":"702A03BJYC0CD02J0A"," voi":"74Z806C3SGBNJ58"," vol":"71480490QA1RB1NC5BD2CF04H05IFJJ07M02"," voo":"B05DAT"," vou":"7H6B2Q"," vr":"71ID2BF02J6G"," vä":"F6CG42"," væ":"H2M"," vær":"H6J"," w ":"LD1"," wa":"7028CH97BA02B03D8OF02G02L1XM02"," was":"8D396KD9LL0H"," wat":"818DA4"," we ":"85MD9QL0B"," wh":"88WB02"," wie":"96ZD2NL86"," wir":"9B3"," wit":"86Q906D0GL05"," wo":"85K92WD26L22"," wy":"L8Z"," y ":"72JA8M"," yap":"MFB"," ye":"70F81KA05F02J04M8R"," you":"7028LO"," za":"908A0DB07C02D1VI0EJ07LELM6A"," ze":"91FB03C0AD5QI0AJ0LL2FM0W"," ze ":"DCCL1J"," zij":"DII"," zu":"989A03C06D0PI03L0C"," zu ":"9D5"," à":"73CB0Y"," à ":"7F0B37"," á":"A08B0EI2W"," ä":"90BFCOG13"," är":"904FOEG05"," är ":"FRS"," å":"F1MH6J"," å ":"F02H94"," ç":"70OM8P"," ço":"MAT"," çok":"M9Q"," è":"C5N"," è ":"CIM"," é":"727A21B4XD05H03I9Z"," é ":"BI9"," él":"70NA5YI2E"," él ":"A8XI0R"," és":"A0BB08I5O"," és ":"B0AICW"," ét":"76PI0I"," ê":"70N"," î":"JBJ"," în":"JQR"," în ":"JMV"," înt":"JCC"," ö":"905F1SI2KM50"," ø":"H18"," ü":"917I13M24"," ş":"J0EM61"," şe":"M8W"," şey":"M8F"," ż":"L5R"," że":"L8U"," że ":"LAM"," ș":"J49"," și":"J8Y"," și ":"JBW"," б":"KFE"," бы":"KFG"," был":"KCH"," в":"KQJ"," в ":"KJ7"," все":"K7D"," вы":"KF9"," вы ":"KD5"," д":"KHK"," до":"KCG"," за":"KFA"," зна":"KAI"," к":"KGJ"," ка":"KCG"," как":"KBV"," ко":"KCE"," м":"KM1"," мен":"KAA"," мн":"KCI"," мне":"KDC"," мо":"KET"," мы ":"K9E"," мэр":"K7K"," н":"KS4"," на":"KOV"," на ":"KGM"," не":"KSG"," не ":"KSG"," о":"KLC"," он":"KIF"," он ":"KE5"," она":"K8T"," п":"KR9"," по":"KSD"," пр":"KMB"," при":"KCM"," про":"KEF"," ра":"KCG"," с":"KQB"," ска":"K8F"," т":"KPP"," так":"K94"," те":"KBU"," теб":"KAT"," то":"KPV"," том":"KQN"," ты":"KEE"," ты ":"KIB"," хо":"KBV"," ч":"KEK"," чт":"KKA"," что":"KOQ"," эт":"KL4"," это":"KNI"," я":"KGE"," я ":"KQH"," 他":"2I4"," 他们":"2F5"," 你":"2IJ"," 你可以":"2R5"," 你知道":"2O9"," 她":"29B"," 如果":"2E7"," 如果你":"2SA"," 我":"2SG"," 我不":"2OU"," 我不想":"2O0"," 我不知":"2SD"," 我们":"2QU"," 我們":"2O2"," 我喜欢":"2P1"," 我在":"2CQ"," 我希望":"2PL"," 我想":"2I9"," 我的":"2IV"," 我知道":"2RE"," 我觉得":"2O9"," 汤":"261"," 汤姆":"2SG"," 汤姆不":"2OI"," 湯姆":"2MC"," 这":"26O","' ":"802902C0CD02I02","'a":"753C19L02M1D","'ai":"79OC02","'ai ":"7B4","'d":"80LM1N","'e":"73DC0GM04","'es":"7AHC0R","'est":"7ENC0E","'h":"70JC0H","'i":"71DC0IM08","'l":"80RM0F","'m":"814","'o":"70MC0B","'r":"80S","'s":"83K905D0C","'s ":"875908D0I","'t":"863M06","'t ":"8BS","'u":"70PC0BM3K","'un ":"73HM8K","'v":"80Q","'è":"C0K","'é":"70X","-a":"B02G05I02J4T","-a ":"B05J9K","-c":"70KB02","-l":"707802B0KJ0H","-v":"70TB02G02I02J03","a'":"809D03M16",aa:"90BDDZGD4I03L02M0R","aa ":"GJO",aan:"D5AGGL","aan ":"DE7GMY",aar:"90CB02D9PG0V","aar ":"90KDMG",aat:"904D2KG38L02M1O",abl:"72E81L902A41F02I0DJ08L03M05",aca:"70B803A1RB1LC16J1OL0IM9H",acc:"71R80JA0LC5GD02F06J0V",ach:"72581596DA0KB46C04D28J07L2M",aci:"70P805A5WB1LC1GI02J1JL1VM05","ado ":"AEOBB8C40",adı:"MB0","ag ":"80491FD2LFR8H1OI0JJ04",agy:"IBH",agyo:"ICV",aid:"71B837A02B02D02G0KI09J04",aik:"G8VI03",air:"76K80SA08B0TC02D04G0NI02M0G",ais:"7HE805902A09B8ZG9TJ02","ais ":"7JNA0BBAO",ait:"7DS80KG2QI09M07","ait ":"7JB80HD05G08I0MM06",akk:"D0GG1NH2KI15M2R",alc:"707802A0HB0BC47J0LL06M07",alı:"MAI","amo ":"A0EB0FCDVL0C",ando:"70E804A97BA4C8CD06I07J05",anno:"70680ECA6F07G0I","ant ":"7AE84R90ED1RF10H2MI0GJ1SL03",any:"82UI1SL1PM0N",anı:"MAY",aq:"707A0UB18",aqu:"710A2RB5A",arı:"MFI",ası:"MAT","ato ":"802A1KB1HCLFG04I02L05",att:"72M80S917C7BD09FJ8G4FH2VI22M1S","att ":"90CFLIH40I26","au ":"76S90PB08D04H02J9V",auf:"70894RF02L04","av ":"F52H4LJ0BM04","ave ":"70C88PA0IB0EC0KD02H0D",aw:"80OD02L5H","ay ":"702852A2KC0IM1L",aya:"708803A0YMBU","az ":"A0JB1KIGQJ0AL1YM4J",aze:"802B5MC02D02I02J06L0LM0Q",azi:"704805903B0BC5OD03I0BJ17L0CM0D",aç:"702B1FM2A",añ:"A1M",ać:"L4M","ać ":"L99",ağ:"M4L",ał:"LBO","ał ":"L8S",aş:"J08M62",aș:"J23",aț:"J20","ban ":"702802A19G02IG8M06","bb ":"F0HH07I4H","ben ":"7029AIA0KC04DCFF0CH0IIBNM83",bia:"803A0LB10C4EG02J08L0Y",bili:"70E809A0IB0FC0SI03J0OL0BMA4",bir:"808A0JB04C0OI04J0MMQH","bir ":"A0MB03MP9",bt:"803919A02D0EF04I02","bu ":"704L05MBU",bí:"A0MI0I",bø:"H0K","c'":"715C0F","ca ":"805A5EB6RC5NI05J60L1MM30",cas:"70Q80BA4VB59C30J30L02M0B",cer:"71H80GA51B3SC3VD02F08I05J4AL0CM0H","ch ":"70583I9MMA02B02C04D1CF6PL76","che ":"73K80396OA35B07CQ7D12J0H",chen:"7078059C9A03D0NF09",cho:"72W80V914A4PB3PD0WF06L41",cht:"9EFD4M","cht ":"9LXD9D","ci ":"72SB0HC6GI03J8EL52M15",cie:"71O809A39B10C0UD04F05J0SL8J",ció:"A59I0DL0G",cke:"70280O912F6U",cl:"70G80YA0QB0GC06D02J0M","co ":"702802A56B5FC60D02L4Q","com ":"BARL03",con:"77S81YAENBDQCC5D0DI02J5FL05","con ":"704A9TC8LI05",cont:"74680TA58B79C49D0KJ2N",cor:"72F80FA2GB3XC55D03J1PL05",cos:"703805A2TB1TCEHI02J0Q",cost:"703808A0WB0YCCHJ0N",cq:"C06",cs:"702802I9B",csa:"I4X",ct:"70R81PA16B03D0EJ1DL02",cu:"70V80QA4KB1NC20D06I05J8FL13M1D","cu ":"706JA2L0PM0H",cz:"LFV",czy:"LCZ","czy ":"L92",câ:"B02J2M",cê:"B4R","cê ":"BFB",cí:"A0FB03I03",có:"A0NB03I02L0B",că:"J7G","că ":"JJZ","d'":"720808C08M03",dad:"803A61B6BF0RM0I",dag:"902C09D12F45H2BI0C",dans:"79QD0CF0DH0HJ0AM0D",das:"999A2HB43C02F0AG09I08L08M0S","das ":"9EVA3QB4TD04F07G05","dat ":"703DKNF06G07I27J2V",dde:"806C03D0MF1JH2KI05M0R","dde ":"C02D0KF1LH5OM02","deg ":"H7UI0L","des ":"7BQ807934A3RB1GD04F1SG0MH09I0CJ0D","det ":"91DFOHG0MHPFI1QM02",dett:"704C4GF1KG0OH5QI1HM09",değ:"M8T",deği:"M9M",did:"70384IA18B0YC03I02M04","die ":"70I8079HZA1LC02D5AJ05",dig:"70680290QA0KB0TC05D1JF7PH2UI24","dig ":"90MD3XF7PH66I5A",dl:"80990BF0DH0II03L1L","dn'":"83U","dn't":"86Y",dos:"706A66B79C0EG09I06L0XM09","dos ":"707A8WB8HI04",dov:"C5FJ09",dt:"90AD0RF02H1EI2Z","dt ":"90BD14H1XI11",duğu:"M85",dz:"D02I04LEG",dzi:"LKJ",dzie:"LFS",dä:"902F0XG2I",då:"F0DH07",dé:"71SA0AF04H02I1D",dì:"C06",dí:"A10B02I0F",dó:"A0NB03I0FL07",dø:"H0O",dü:"903I0FM5O",dı:"MBL","dı ":"MBL","e'":"81MM07",ear:"83I902A0IB08C03J1E","eb ":"906A02C02D34J0CL04M02",ece:"70480FA4BB5TC0SD02F02I03J2LL08MCC",eci:"70P80LA3QB5NC1LD04F0HJ2HL2FM0B",eef:"D3M",eeft:"DB7",eel:"80L903D2OF02G13","een ":"83J905A07C03DRHGBPH05",eer:"808909A0OD4BG04H03","eer ":"80A90AA0VD8WH06",eft:"80ID3OF1HH04J04M03","eft ":"80XDCTH07","ego ":"803A17B0PC0BLFR",egy:"802F02H0KIFW","egy ":"ILW","ein ":"70H9HCD13G30H0AI03",eine:"70R9NGD0IG0VH0BI05",eir:"80Y908B69H02I02",eit:"807952A04B3BD0AG40H08I0A","ej ":"F0NI03L9Z","ek ":"80C902D23F0FH02IDUL3HME0",eke:"804902C02D1XF09G1AH09I7BJ03L04M1D","ele ":"91PA0NBDIC0MD1VG0XH1JI2QJCTL1BM0I",elig:"706806907A11B0HC06D09F05H6BI02J0HL08",ella:"809A7WC70D02F0NG7PI02M02",elle:"7J2808929A08C3ND20F25G4WH5GI6VM0L",enc:"74281LA4OB34C02I0QL0FM1W","ene ":"80390OA5AB02C3MD0JG0SHAUI1XJ0FM0O",enge:"70380590OB03D20F0WG03H72I4MM09",erc:"71I807A1AB13C5JI0FJ1KL0GM0L","ere ":"89L92JA1NB0CCF5D1WF02H7FI0XJ54M1L","ero ":"802AB0B3XCA2G0DL07",ery:"831G03L0TM06",esc:"70H80791NA4HB66C27D0JJ6A",está:"AB8BAN",esz:"I7ML7R","ete ":"80491CA0ZB0TC9QD0EF0MH0DI1CJ0ZM0I","ett ":"90LF8EH45IBZ",ette:"76P81D911C2ZD17F0HG4GHANIA4M0H",että:"GDJ","eu ":"72Z902BOVJ6F",eux:"78N","eux ":"7CV",ey:"82CA08G05M8V","ey ":"83UA0DB02C03M4U",ez:"72F90DA1CB19C0ID21I9UJ2LL23M1N","ez ":"782A2EB39I6OJ1QL1YM1Z",ezt:"I4L",eä:"G0N",eç:"702B0PM1Q",eñ:"A0L",eğ:"M6O",eği:"MEV",eğil:"M8S",eș:"J2L",eșt:"J80",fai:"78Y80AC09J04M02",faz:"B6BM1Q",fd:"D0L",fj:"F04H09","for ":"87KB07F02HE2",fs:"702908D07",fy:"F07H08",få:"F12H0R",fè:"702C04",fö:"F6RI0K",för:"FG8M02","för ":"FCB",fø:"H1K",fü:"91XI0E",gee:"D25","ger ":"72Y812921A09B04C0FD26F4HH9KI08J05M02",ggi:"802C4J",ght:"84F","ght ":"702871",gio:"706805902A0CB0FC5ZF02H03J03",gj:"F0MH2YI0R",gje:"H1MI05",gjø:"H2B",gjør:"H5Q",gs:"80I90WD0DF0OH11I0T",gt:"705921D0NF25H0RI18","gt ":"705926D0UF5SH0S",gv:"H08I0K",gy:"804F02G02H0EIMM","gy ":"805IMK",gye:"I6I",gyo:"I62",gå:"F23H1M",gö:"F1GI0CM47",gör:"F3YI05M7E",gü:"902A03I0AM3I",hab:"70Z80294BA5UB07I02M0M",hac:"707903A53F05L02","han ":"81RA13D02FFHG3AHF6","har ":"A0FB1NFG4HIEI05J04M06","hat ":"70L8MX986D05G0FI0VM0E",hav:"84JB1BD02F06G06H07I06M16",have:"87PB0KD05F06H07I03",hd:"802903G1WM02",heb:"903A02D53","heb ":"DB7",hee:"807C0BD3ZG0O",heef:"DAM","her ":"71R89B93HB0XH2NM4Y",here:"87T90CA03B0CC08D03G04","het ":"702DQGF1BG09H2HI3C",hey:"83MM0D",hij:"A0YD4Q","hij ":"DFK","his ":"7038CMJ0QM02",hj:"F0SG09H15",hje:"G08H1Q",hl:"80292QG05L03M0A",hm:"91CG0NL05M04","ho ":"819A3LB96C71G03L04",hog:"A05D02IBW",hogy:"IOC","hon ":"705928F9PG0GI19",hou:"708843B0UD1EG05",hr:"70480N965D0FG02L05M07","hr ":"94G",hre:"80P93ID07G06M04",ht:"8279A9D32G2BM15","ht ":"83W9BLD2K","hun ":"D1DG0MHA3",hv:"G08H5IM0B",hva:"G08H2QM08","hva ":"G06H6R",hve:"G02H1RM0L",hvo:"H3D",hvor:"H89",há:"A02B0MI2Z",hã:"B0F",hä:"910F3NG5S",hän:"90AF1EGHN","hän ":"GKG",häne:"GA2",här:"F7RG02","här ":"F9X",hå:"F0XH0F",hé:"70EA02C0XI0W",hö:"914F1JG03I09",hø:"H0X","i'":"827M0D",iac:"A03C4II02L0B",iam:"702804A08B18C9YG04I0BJ0GL0S",iamo:"A03B02CCY",iał:"L8P","ich ":"70380X9SGA02C04D2AL2Q",icht:"9LFD2V",ici:"72X80GA3MB20C4DD05F08I0CJ9ZL0JM0P","ido ":"A84B4WC0OL02",iedz:"L7I",iene:"90BA7WB02C0WD08G0MH05L0Z","iet ":"702807905DLBF0DG02H0PL03",igh:"70282ZC02D05F0SH11J02",igt:"70490KD07F53","igt ":"70390YD0RF6P",iin:"G9UJ0K","iin ":"GC9","ij ":"D81L0L",ijk:"D3I",ijn:"D87","ijn ":"DN9",ikk:"D07G6PHCOI04M0R",ikke:"D0RG0YHNRI06",inde:"703807933A07B07C03D3JF0CH0CI9EJ0YM5U",inge:"70780892UA06B03C0CD3AF60H86I09J0Q",inh:"903B93G07",inha:"702904B7L","ini ":"70FC20G1IJ0VMCC",inul:"GBJJ0Q",inun:"90GA02B02C02GAYJ0O",inä:"GBK","inä ":"GI2",iq:"70PA04B07","ire ":"7E380MA0CB05CFCD05G0AH0FI2AJ1DM07",isk:"803903D04F3JG2JH1WI0QL0SM09",iss:"74080M91ABAGC1UD0JF1VG6UH0TI1BM16",isso:"70PB99G06","ist ":"80T9K6D26F0FH1BJ0WL0HM06",ith:"70283XB02F02G02L02M03","ito ":"803A2PBA0C68G08","itt ":"90DF4QH6NI5U",ità:"C4G",itä:"907GDT","itä ":"GGE",iy:"MDH",iyo:"MIL",iyor:"MKC","iz ":"702A0OB1VM9Q",ià:"C08",iä:"G14",iç:"B0BM6B",içi:"MAF",için:"MBE",iè:"70N",ié:"70CA0PI16",ië:"D0F",iñ:"A0G",iò:"C0A",ió:"A3DI0KL0H","ió ":"A4EI0A",ión:"A6G","ión ":"A9N",iù:"C0W",ię:"LBV","ię ":"LH5",iğ:"M3S",iği:"M94",ił:"L4K",iş:"J02M3V","j'":"71U","j'a":"774","j'ai":"79W",jag:"FQD","jag ":"FSG",jd:"D14F06I0OL0L",jeg:"HHRI0DL2S","jeg ":"HSG",jest:"G0MLM6",jf:"D0GI02",jg:"D07L02",jk:"D2BF05I02L05","jk ":"D2B",jn:"D5II0BL0I","jn ":"D7O","jo ":"A43B0UG15H09",js:"D0BI0AL0Y",jt:"D08I1E",jv:"D0A",já:"B0LI3H",jä:"F1LG1I",jæ:"H08",jø:"H2I",jør:"H2P",kaa:"D0JGB7","kaa ":"G9I",kai:"G6LI0EM02","kan ":"D67FA6G1JH8PI0FM0M",kell:"903G2CIB9","ker ":"80A90PC02D2ZF7KHCUI05M09","ki ":"703A03B03C02G4MH02I5ZL5GM65",kj:"D04F05H2NI03",kje:"D05H2A",kjø:"H1J","kk ":"H29",kke:"D14G0YHEJI0PM07","kke ":"D06G02HNM",kla:"90GD0GF26G06H1TI04L0JM5A",kn:"825905D06F0TH0DI0TL0XM08",kno:"83L902D02L07M02",know:"86E",kom:"91ZD1MF6ZG0VH31I0ML17M0V",komm:"94HD03F6VG09H56I07",kor:"905D07F2CG1HH0FI4RL0KM1Q",ksi:"GAZH04L1LM14","ksi ":"GDQM05",kt:"91CD1YF2ZG05H2SI0UL2OM5D","kt ":"912D29F2SH17L0S",kte:"90ID0MF2LH1TI0CL03M4S",kv:"F0PH0II04",kw:"902D0HL0B",kä:"906F15G43",ké:"I52",kö:"90VF0ZG17I44M0Y",kı:"M4K","l'":"72VC2GM04","l'a":"76DC3D","lar ":"80F90DA2UB2WD08F5NH19J0JMAE",ları:"MBV",lc:"70280290EA08B03C14I0LJ0AL06M08",ldi:"807908A02C12D0AF1AH1MI04M5D",ldu:"902J06M9W",leri:"702905C02F02G03H06M97",lh:"702902B32F02G02H03I0Z",lho:"B5XI03","lig ":"90LD0KF2MH9JI0Q",lij:"D3EG0UI02J03L02",lijk:"D9Y",lik:"82U902D04F10G0TH2KI0IL0GM3S",lj:"D02F16G15H07I2A","lle ":"7IR931A0HC53D1AF5MGGRH9VM04",ller:"73080890YA08C0BD0MF3KG09H5OI05M0X",llä:"F03G91","llä ":"GDN",lma:"702A0AB0CC04D02F02G36I18J05MAM","los ":"70480490MAG6B1ID05G0ZI0AJ0JL02",lr:"807A02F06I0E","ls ":"74S80V92BD2BF0LH02",lui:"73BA04B06C4ED0FG0KJ8J","lui ":"74PB02C6WD03G04JD9",lw:"80BD02L09",lá:"A0AB0EI6D",lä:"90QF2SG4R","lä ":"F02GAF",lå:"F1FH0G",læ:"H0T",lé:"70XA0EB03I2X",lì:"C06",lí:"A0KB0EI0F",lö:"909F0XG0II0P",lø:"H0X",lă:"J26",lı:"M7Q","m'":"70N80CC02L02M4R","m'u":"M8S","m'un":"M8B",maa:"D2VG78M06","mai ":"702C40I0EJEE",mais:"782B8IG1H","mak ":"D02H04I02L03M8H",md:"903D0EF0AH02M20","med ":"80YF8WHB7I05",meg:"C0PH4LIEJL07","meg ":"HAXICL",mek:"G0NH03I0JL09M8Z","mek ":"I0CL0BM8F","mer ":"71C80G93SA1FB0YD23F6RH77I07L06M02",meu:"70GB59J2U",mig:"70580JA1WB2FC17D04F7FI02J03L03","mig ":"F9TI02",mij:"D3RJ06L03",mijn:"DA7",mind:"80J906B08D0DF0AH0CIE3M07",minä:"GB9","mit ":"708807979F0AG03ICJJ1M",mitä:"G9U",ml:"906D02F0HH0AI0JL05M1R",mma:"70F804902C0TD02F4UG1MH05I0H",mme:"77Z80E93PC0WD0HF58G7KH5KI0AM0A","mme ":"76190PC02D05F0CGAWH3U","mo ":"A6FB71CC8G0NL0K",moe:"B04D2V",mond:"72480F906C0OD0AIAYJ07","mos ":"AB3BAVI0HJ0Q",mt:"90QD0EF0RH0UI07J05L06",mui:"B6ZD02G19",muit:"B8EG09","my ":"835L7R",má:"A23B09I5K",már:"B03I4Q","már ":"I98",más:"A5TB0AI3O","más ":"A8QB0AI40",mã:"B0P",mä:"90DF0QG3S",må:"F1WH1W","må ":"F08H1N",mé:"70MA08B08I44",mí:"A0HB05I0H",mø:"H0J",mă:"J2Y",mı:"M5R","n'":"722866C0CM14","n't":"8BS","n't ":"8JF",naa:"D2MG1V",nagy:"IAD","nak ":"IGBL08M04",nb:"90BD0AF08H06I0OM02","nde ":"743931A3VB4IC1XD3MF69H3GJ4FM4K","ndo ":"804AE4BFICBZ",nek:"F02G0FH05IATL0FM0I","nek ":"ID8L0LM08",neke:"G03I9R","nem ":"93MB14ISGJ0AL0WM0F","nen ":"9DJA1AD8VF3KGKGH5FI0JM09",ngen:"70794GA06B04C07D4ZF60G03H78",nger:"72I812917C0PD1LF1RH6XI0QJ0B",nha:"802907B8LF02G0VI02","nha ":"B7WG0S",nho:"904B7KD02G0BI03",nich:"7029HRC02D02L0C","nie ":"70J91LC02D09F02I0ZJ17LSG",niet:"A03DLNL02","nin ":"F02G26M9Y",nlar:"M9D","nn ":"94SF0PH3EI06L02","nno ":"CA8L05",noe:"D0EH2ZM08",non:"71G804COCF02G0RI03","non ":"71ICSGG0LI07","nos ":"70UA7LB5TI14J0AL02",nou:"79980FB0SD02G0NJ1O",nous:"7CNG0U",now:"84JL2D","now ":"86W",nq:"70AA06B07C06",nsk:"F3EG2CH30","nte ":"73J92AAERBERCEGD0MFKMH2EI0OJ3S","nu ":"70YB02D0MF29G05JMAL0XMG5",nul:"708C0UG6OI1GJ48M03",null:"705902C1DGB4I03",nun:"90QA1LB28C08G6LI0EJ0YM94","nun ":"90AGAZM89","nut ":"D02F04GB6J0UL0BM02",nyt:"80MF08G5XH0AI0T","nyt ":"GA6I1M",nz:"91JA0FB02C1ND0CI0VJ09M08",ná:"B05I3E",nál:"I49",nã:"B64",não:"BLP","não ":"BOH",nä:"90BF1NG61","nä ":"GDF",nå:"F1PH1N",någ:"F4E",næ:"H09",nç:"707B0SM0N",né:"70UA07B02I3W",nó:"A08B0QI04L0B",nø:"H0I",nă:"J2E",nı:"M9X","nı ":"MBV","o'":"804C0AD05M05",oar:"804B07F04J9D",och:"714931A28B05C0AD0ZF6HJ0UL38","och ":"959D11F8NL03",ocê:"BH6","ocê ":"BHX",odo:"A4HB3GC0QG18I0GL1E","oe ":"802A02B03C02D1NG02H1P",oen:"B0FD1WF04G05H1L",oet:"A02B03C02D2FG08J02L02","of ":"876904B02D10",ogy:"803IC3","ogy ":"805INQ","oi ":"773B46C7MD07G5MJ5UL0D",oin:"72X832A03B02C03G5IJ05L03",oir:"75XG12",ois:"75N805A06B40C02G6MJ04L03",oit:"73EB1JD0TG7BJ03",oj:"A0JB0IF08G0RI04L4BM04",oldu:"I02MAA","ole ":"71I80I903A04B04C48D02GB2H0EL0P","oli ":"705C0VGAPI02J05L0L","olt ":"903F06H0AIBO","om'":"80OC07G02L04MBW","om'u":"M9Y","omi ":"B05C05F04GAUI5IL02M02",omm:"77880D924C0HD09F5NG1AH2UI0E",omme:"7AP80693JC0LD0HF5BG0FH6P","on'":"83XM23","on't":"86Y","ono ":"A0OB0GCJ3G0EL0E","ons ":"7BI81I902B09D2QF02","ont ":"7BI809902D0UF0JI13J06",oor:"80JD5G","oor ":"80VDB7",opp:"70980E902C1OD06F1OG1NH2TI02","oro ":"A0HB0IC8EG04L0D",orum:"902J05ME3","osa ":"703A24B18C8DG0CI08L04",oss:"71080K90CB4YC4SD04F1SG2WH1GI1L","ost ":"81Q905D0KF0DH0EI5IJBJL06M02",ostr:"A0JB0LCGKF03J0UL15","ott ":"90DF0UH08ICP","ou ":"71H8AJBHKD23J1E",oul:"72N84VG1AJ0O",ould:"88L","our ":"7CD85E",ous:"7K381UB04G0S","ous ":"7QP81LG07",out:"76K840B20D0BF02G0N","out ":"76186GD0P",ouv:"767B1AG03","ow ":"86KB02",owi:"806L8I",oy:"70G80EA1VM1K","oy ":"80CA5LM08",oz:"903A09B0DC0AD04I4BJ0BL2JM09","pas ":"7NKA0DB0ED0AF0OG06",pg:"D07H03","por ":"ACDB9GF04I02M0E",pou:"7AH803B1LG02",pour:"7DN803",powi:"L7U",prz:"LD2",prze:"LAN",przy:"L8S",pue:"A6S",pued:"A7I",py:"809G10L0NM02",pä:"908F03G2D",på:"F4UH4S","på ":"FCIH7D",pø:"H0F",pă:"J23","qu'":"77B",qua:"72G808903B8NC8V",que:"7LK80K904ANZBSDCB0","que ":"7OQ806ARCBRKC0W",quer:"70V903A28B88",ques:"73480LA0EB0DCBK",qui:"75S80PA81B5UC2J",qué:"70PA5C","qué ":"70RA7Y","r'":"804M04",rai:"79P810902A06B0XC1GG0KI04J08","rea ":"806A0GB04C06D02F02G02JC1",rec:"71780R91DA5CB72C0ZD0GF0GI03J4NL08M1H",rer:"71X80290YA0LB0QC0XD02F0JH2HJ0OM09","res ":"77K80K90SA8NB49D0GH18I0ZJ04L0AM02",rij:"B02D22J10",rj:"D02F0LG1JI10M03",rui:"70N804A0GB0EC7MD0SG03J0I",ruir:"704A05B04CBL","rum ":"926D04F0MJ0BL03MDZ",rw:"80390KD0EL10",rz:"912A06C05D0BI0MJ0ALDCM03",rze:"90LC03D03I0GLDD",rzy:"LAE",rà:"C0V",rá:"A1GB17I48",rä:"90MF2IG0U",rå:"F1VH0X",rè:"70U",ré:"71YA0UB04I1F",rí:"A2EB08I0C",ría:"A6MB0D","ría ":"A7S",rò:"C0U",ró:"A0NB0AI21L29",rö:"909F19G02I0T",rø:"H1H",rü:"918I13M2J",ră:"J4A","ră ":"J82",rı:"M7Z","s'":"70W802C05M04","s-":"71BB02I02J1E",saa:"B02G63M1K","sak ":"F0AI96M06",sco:"709808A0XB2WC4FD03J0VL02",sd:"902A08B03D06F04H05I0H",seg:"A1TB2UC2PF04H1XI1D",sei:"70Q947A09B2RC2HG1YH03I06J07","ser ":"73P80593KA2LB3FD05F2PH60I02L03M07",she:"855903D02F02G02I04","she ":"86Z",sic:"70380H93MA0RB0WC20J0KL02M02","sie ":"70E9FHC02D0KJ08L11","sin ":"70I803904A21F2TG9TH2PM5X",sinu:"GCBJ05",się:"LF3","się ":"LJI",sj:"D0EF0WH1JL06","sk ":"80HF1EH2OL04M02","ska ":"F8TG1UI0QL0J",ske:"80O902C02D03F18G2YH4SI09M0C",skj:"F0CH1O","sn'":"83H",sna:"802D04F1DH1QI0NL04M02","so ":"81B91ZA65BDOCBNG0IL04","som ":"B04F79HATI0R",sono:"B07CFS","ss ":"81Y94GF2LH1XI0F","ssa ":"709802B3KC1ZF0XGL5I0C",sse:"76S80V94CB7NC63D0VF0SG06H1RI0FM14","sse ":"74H91EB79C3YD06F02H1NI04","sso ":"BC7C7N",ssz:"I4N",ssä:"F02G6O","ssä ":"GAI","sti ":"B02C2UGA5I05M06","sto ":"905A4RB4RCCZF03G0FH0DL1C",stá:"A7LB8XI0A","stá ":"A81BA5",stä:"90EF2NG9I","stä ":"GB6","su ":"704A5WC0TG0DL12M0W",sunt:"A0AB09C04G08JEJ",sv:"903C0AD03F18G0BH13I04M02",sw:"80E906D03L1G",sz:"906INDLFB","sz ":"I7GL8Z",sza:"I4KL2O",sze:"903ID4L4V",szer:"IFSL06",szo:"I4BL0K",szt:"I4HL0Q",szé:"I4E",sá:"A03B07I2S",sã:"B10",sä:"907F1RG3S","sä ":"G8R",så:"F24H24","så ":"F41H35",sé:"70XA0KB05I3U",ség:"I4N",sì:"C0K",sí:"A0IB07I0Q",sö:"F0WG06I0NM42",söy:"M9A",söyl:"MAI",sø:"H0T",să:"JA3","să ":"JP5",sı:"M84",sın:"M92","t'":"70E81F902C03M02",taa:"904D1DGBNM02","taa ":"GD1",tai:"76K80KB0DC0PD02G4VI0CJ0N","tam ":"B0UIECJ09L1TM0W",tb:"802905A02D08F06H05I0QJ02M04",tc:"80FD02F02I05J04L06","ted ":"86VA1DH0FI39","tem ":"805909B6QD06IDHJ2NL51M02","tet ":"92XF28G09H5WI2CL03",tg:"907D09F02H02","th ":"70284YA02B02L02M02",tha:"7028DL904D02G06I0TM02",that:"8KNI1A","the ":"7028QB",ther:"70288H903D02",they:"86H",thi:"703891903M02",thin:"89L905",this:"86S",tid:"702A19B1GC07F3EH22J02M0A",tien:"71K807904A87C0DD0VF02G1HJ06","til ":"70680G902A0BB0DD08F04HFHJ07M04",till:"70981L907A0DD03FBDG0AH1A",tj:"D0IF0FH0BI0U",tk:"903D03F03G2YH02I0WL2BM0A",toi:"72GC0CG5SL04","tom'":"817G03L05MDE",tomi:"C02F03GIAI7HL04",tos:"704903A41B4RC0ZG2FI1UJ07L07M05",tou:"78F807B5UG06","tre ":"7EE802A17B12C3KF1VH24I0NJ3HM06",treb:"903C0NJC8",trui:"70GA09B08CBPD05J0B","ts ":"75S83C913D1RF16H0EI09","tt ":"90PFO9H70IEH",tta:"70E805906C4WF5UGDTH04I3EM0L","tte ":"76080294LC2ZD1BF0UG3BH96I4BM0G",tti:"70780J902C55D06F0RG6YH0HI05M72",tto:"707804CB1F0AG1UH04I03","tto ":"CEAF02G0B",ttä:"902GCR","ttä ":"GDI","tu ":"7BBA2PB0RC2AG1QJ1EL2HM1M",tw:"80E90YD0SL2N",tz:"92DD05",tà:"C1H","tà ":"C5K",tá:"A2IB2DI5A","tá ":"A5CB8H",tã:"B11",tä:"90IF1GGF4","tä ":"GNT",täm:"F0IG61",tämä:"G9W",tää:"GA5","tää ":"G9V",tå:"F0XH0U",té:"721A0EB0EI4Z","té ":"773A0UB19",tò:"C05",tó:"A0QB0AI2HL1I",tö:"905F0CG0WI38M03",tø:"H0F",tă:"J68","tă ":"JG5",tı:"M71","u'":"71I80O",ual:"70480M902A18B2AC4TG02J0FL05",uan:"71SA2RB57C3AG1PH05M03",uch:"71481793NA4AD0AL1F",ued:"804A6CB04J02",uer:"71M90QA5RB75C0AF02H05",ues:"72N80J904A3DB0FC7IG04H02",uest:"71180NA4BB09CBJG02",ugh:"82V902J05",uh:"70290LG1QH02I0CM0J","ui ":"786A0CB3SC6WD02G2LJBB",uie:"70H803A5PB03J59",uir:"70M804A0MB0OC7PG02J03",uire:"70S805B02CBP",uis:"76N803A0LB0XC07D1FG21",uit:"72L80KA0IB75C0BD2MG0LJ3E",uito:"A06B7BC0AJ06",uld:"84T90DB07D0BF07M1F",ull:"70580F902A09C1KD1NF48G93H1QI09M1D","uma ":"A06BD8C02G0EI02J09M0H",una:"703805903AA9B07C7TG2CI06J2TM1P","una ":"AE3B04CBLG1DJ3EM1L","und ":"81R9C1F1DH0SJ09",une:"7AJ805908A0AB02C0LG0ZH03J4QL05","une ":"7FQ804904C0EJ3S",unk:"80690EF0DG0OH07I58L0IM02","unk ":"808I9F",unn:"807902C07D0NF14G33H27","unt ":"80A902D1HF0DJD4",unu:"G1QJ1CMEA","unu ":"G02J06MC2",uo:"70IA03B03C3JG58L02",utt:"70380690HC4WF0IG78H17I02M0K",uu:"D0RG5F",uw:"D1ZL0Q","ux ":"7A6",uy:"70280CA12M3V",uz:"903A07B09C04D07I04J10L0GM2X",uá:"A0MI02",ué:"70DA20B0H","ué ":"715A5F",uí:"A0OB06",uò:"C0C",uğ:"M3G",uğu:"M8G","v'":"C04",vad:"A0DB0IC2ED0DF5DI0CJ0BM05","vad ":"F6YI03",vag:"706A03B08C08F04I5VJ02",vagy:"IDS",vai:"76E802A03B2QC2BG67I03","van ":"A0MDGZF06G4GIGPJ05M05","var ":"A0KB0RFCEHAII06M72","vat ":"D06F04GCVI05J0VM05",vd:"F06H09M0L","ver ":"72084M904A29B35C0LD4NF4ZH5UI05J05M12","vet ":"F3TG05H5JI2CM0L","vil ":"804A06B02H7M",vill:"717805A0AC05F68G0NH2HI0F",vl:"D0FF0BH03M0K",vn:"F03H0GI04","vo ":"A2HB2SC51G03",voc:"705A0EBH9C0DD02J0D",você:"BJX",voi:"75I806C2DG7OJ50",volt:"B1KC21D02IDFJ08",voo:"B04D34G02",voor:"DB7",vor:"706807921A1MB23C4UD0BF0JH3IJ4EM04",vou:"7E5804B2LD02",vous:"7JG805",vr:"712B0MC0PD1PF04H02I02J1TM0I",vv:"C0GI03",vá:"B07I3Y",vä:"F3EG46",vå:"F15H0L",væ:"H1T",vær:"H2W",vé:"70KA03B02I2Z",waa:"D2P",waar:"D93",wan:"83890OD0ML2P",war:"80M93ZC02D0QL1A",was:"87K93ND2PL0G","was ":"8BP97SD9DL0A",wat:"80OD2TL08","wat ":"D93L03",wd:"D06L18","we ":"835D30L1J",wee:"70480QC04D2KJ03L04",wh:"84L",wha:"83GB02",wie:"937D0PLE2",wil:"821914D23L0O",wir:"94UL02",wit:"83S904D06L0B",with:"86O",wn:"80OL1S",wo:"83292CD24L5L",wr:"80EL0T",ws:"80FD03L33",wy:"L6E",xa:"704805A05B0KD02F05J05",xc:"704805A04B03J03",xp:"70680FA0AB09J0A",xt:"70380D902A0CB06F05J04","y'":"80HM2E",yap:"I05MDO",yb:"809I0GL1FM0E",yc:"803F2FL3XM02",yck:"F6T",ycke:"F6Q","ye ":"703804A05H1LI0SM7Z",yg:"F0IH0FI04L14M0D",yh:"F02G17I09",yi:"80KG0NI2CM64","yi ":"G16I0UM9T",yk:"F06G1CH14I09L1ZM09",yle:"707804G0LI0DL0CMB8",ym:"702807902F07G12H05I0DL53M0D",yor:"702802A0OB02C02F03G03I0MJ03MRC","yor ":"A0JMH0",yoru:"MF8",you:"7028DI","you ":"8HL",yt:"80JF0FG41H0QI16L22","yt ":"F02G6BH03I0XL0R",yv:"F02G1DH04I0UM07",yy:"G1C",yö:"G1VI0AM06",yı:"M4L",ył:"L4H","z-":"70S","ze ":"70780A90QB0AC0OD4ZI0YJ1FL6VM2C",zer:"80290BB5YC09D03I6YJ08L11M1C",zere:"B02IAGM0A",zie:"90RC19D1PJ0DLCA",zij:"D5P",zijn:"DGG",zio:"B02C7OL0E",zion:"CALL08",zt:"916I8EL0J","zt ":"918I70",zu:"964A03B02C02D0II0UJ0SL22M0T","zu ":"95XL0KM0D",zw:"90RD0EL1Z",zy:"802LEPM06","zy ":"804LA5",zá:"A02I3U",zé:"I3I",ß:"90P",ße:"910",à:"71SB0EC13","à ":"73TB0QC2N",á:"A2OB2SIDM","á ":"A2NB46I11",áb:"A05B03I2U",ág:"A03B0AI37",ál:"A09B07I9K",án:"A1AI66",ár:"A08B0OI8U","ár ":"I55",ás:"A2HB0EI5X","ás ":"A7NB16I3G",át:"A06B06I77","át ":"I6B",â:"706B04J34M0B",ân:"B09J3Z",ã:"B4L","ã ":"B0I",ão:"BA3","ão ":"BS0",ä:"91MFDYGMG","ä ":"F02GKQ",äg:"907F1J",äh:"90SG1S",äi:"G2M",äk:"F0OG1G",äl:"90IF3OG2M",äm:"905F0ZG2C",ämä:"G6Z",än:"90ZF5FGBF","än ":"F2NGNO",änd:"90PF3P",äne:"903G67",är:"90QFFXG1K","är ":"FRUG03",äs:"90BF1AG2E",ät:"90YF2FG2Y",ätt:"90MF4NG23",äv:"F0BG1F",äy:"G20",ää:"G7Z","ää ":"GB6",ään:"GBF","ään ":"GGF",å:"F8XH5K","å ":"F7PHDU",åd:"F0KH0G",åg:"F2T",ågo:"F41",åk:"F0SH0I",ål:"F17H0J",ån:"F2PH0I",ång:"F43",åp:"F02H0F",år:"F33H3Q","år ":"F69H4L",ås:"F15H05",åt:"F1MH0Z",æ:"H0V",ær:"H3E",ære:"H2U",ç:"70IB1HM61","ç ":"M3F",ça:"70WB1GM3B",çi:"M5A",çin:"MAH","çin ":"MAR",ço:"706B0OM4H",çok:"M95","çok ":"MA9",çã:"B18",è:"71AC2O","è ":"C6A",èr:"719",ère:"764",ès:"70R","é ":"74LA3LB5BC0ZD02F04I0W",éc:"718A03B04I02",ée:"71I","ée ":"75J",ég:"70BI6T","ég ":"I55",ék:"I32",él:"70IA1WI6U","él ":"A5YI3F",ém:"70AA02B0SI14",én:"70AA0RD05H03I61",ép:"70PI2H",ér:"714A08B0AI81",ért:"I5V",és:"711A13B07I7V","és ":"72RA34B0MI6O",ét:"728A03B03I45",ê:"70WB2M","ê ":"B43",ên:"B0I",ês:"B1J","ês ":"B6H",êt:"71I",ë:"D05","ë ":"D0B",ì:"C0F","ì ":"C10",í:"A2XB0XI2F","í ":"A1ZB03",ía:"A4PB05","ía ":"ABLB02",íc:"A0DB0F",ít:"A05B04I3K",î:"707J50",în:"703J9M","în ":"JFS",ñ:"A0X",ña:"A13",ño:"A1H",ò:"C0T","ò ":"C1Z",ó:"A2SB0YI3TL4P","ó ":"A41B0FI3D",ól:"A0AB04I3BL0G","ól ":"I4SL0C",óm:"A0JI07",ón:"A33I0I","ón ":"A8FI07",ós:"A03B0VI0OL08",ô:"707B06",õ:"B07",õe:"B0I",ö:"915F7KG2BI4TM3Z","ö ":"F06G1A",ön:"915F0OG0LI3MM2G",ör:"90WF98G08I2SM3B","ör ":"903FBII0EM09",örs:"902F3R",öv:"F1QG02I12M04",öve:"F47I11",öy:"G0IM43",öyl:"MAC",öyle:"MAX",ø:"H33",ød:"H0Z",øk:"H0S",øl:"H0S",øm:"H0G",øn:"H11",øp:"H0P",ør:"H4D","ør ":"H27",øre:"H2H",øs:"H0R",øt:"H0Q",øv:"H0M",øy:"H12",ù:"706C0E","ù ":"70DC0X",ú:"A0KB0CI1I",ún:"A0KB05I04",û:"706",ü:"924I2XM80",üb:"91HM03",üc:"915M0C",ül:"908I4UM18",ün:"90LI2GM7P","ünk ":"I97",ür:"926I0CM3B",ă:"JGA","ă ":"JN9",ăr:"J36",ăt:"J1W",ą:"L5Z","ą ":"L82",ć:"L55","ć ":"LC4",ę:"LAM","ę ":"LHC",ğ:"M63",ği:"M95",ğin:"M8G",ğu:"M3T",ğı:"M5K",ı:"MIA","ı ":"MJR",ık:"M4Q",ıl:"M4N",ım:"M8D","ım ":"MEZ",ın:"MFG","ın ":"MFK",ınd:"M9C",ında:"MA4",ını:"MD9","ını ":"MB3",ır:"M6S",ıy:"M5K",ıyo:"MAH",ıyor:"MBU",ız:"M4Y",ış:"M42",ł:"LD6","ł ":"L9M",ła:"L7F",łe:"L66",łem:"L8V","łem ":"LCC",ło:"L5O",ń:"L11",ő:"I3H","ő ":"I36",œ:"704",ś:"L5Z","ś ":"L4S",ş:"J0HM73",şa:"J03M3L",şe:"J03M4F",şı:"M3O",ţ:"J0J",ű:"I0Q",ź:"L0Q",ż:"L6C",że:"L6F","że ":"L97",ș:"J4G",și:"J3U","și ":"J9Z",șt:"J4E",ști:"JAL",ț:"J47",ți:"J78","ți ":"JDV","̇":"M0I",а:"KPL","а ":"KQP","ает ":"K8F",ал:"KFF","ал ":"KEI",ать:"KHM","ать ":"KJY",б:"K8X",в:"KGE",во:"KDH",г:"K7J","гда ":"K8F",го:"KFL","го ":"KIF",гово:"K7T",д:"KDR","да ":"KBW",де:"KEC",дел:"KBG",дела:"KAA",е:"KQR","е ":"KSG","ебе ":"K7E",его:"KD0","его ":"KEP","ему ":"K8J",ен:"KFZ","еня ":"K9Q",ет:"KEY","ет ":"KH9","ешь ":"K8B",ж:"K55",з:"K7K",и:"KLO","и ":"KOL",ит:"KEI",ить:"KBZ","ить ":"KDO",й:"K5A","й ":"KFB",к:"KCN",ка:"KDZ",каза:"K8T","как ":"K8Q",ко:"KFV",л:"KH7","л ":"KFG","ла ":"KBG",ли:"KD3","ли ":"KFU",м:"KGY","м ":"KLY",меня:"KA4","мне ":"KD2","му ":"KB9",мэри:"K7J",н:"KNA",на:"KM8","на ":"KL5",не:"KO8","не ":"KSF",ни:"KGM",но:"KGF","но ":"KH9",о:"KSG","о ":"KSG",ов:"KD4",овор:"K7V",огда:"K7L","ого ":"KC5","ой ":"KE1",ом:"KKG","ом ":"KOQ",он:"KEA","он ":"KC6","она ":"K9G",ост:"KD5",п:"KBR",по:"KKF",пр:"KE6",про:"KDL",р:"KG0",ра:"KHG",ро:"KEM",с:"KJD",сказ:"K7O",ст:"KJO","сть ":"K7P","сь ":"KC0","ся ":"KIV",т:"KPL","т ":"KHV",та:"KD7",те:"KG3","те ":"KCM",то:"KSA","то ":"KRY",том:"KOJ","том ":"KO7","тся ":"KC4","ты ":"KFY",ть:"KIB","ть ":"KR5",у:"KCT","у ":"KIJ",ф:"K0T",х:"K3O",ц:"K1K",ч:"K84",что:"KKH","что ":"KLT",ш:"K4M",щ:"K19",ъ:"K05",ы:"K9R","ы ":"KJX",ь:"KAJ","ь ":"KP3","ься ":"K8D",э:"K3E","эри ":"K7I",это:"KJ4","это ":"KIC",ю:"K3E",я:"KBD","я ":"KRD",ё:"K2N","​":"207",一:"2H5",不:"2I1",不知道:"2DC",了:"2N1","了 ":"2I3",人:"2AJ","什么 ":"2E0",什么时候:"2Q1",他:"2JJ",你:"2K8","吗 ":"275","嗎 ":"25T",在:"2FQ",她:"29M","工作 ":"2C6",我:"2SG",我不知道:"2SG",我们:"27C",我的:"26P",是:"2JR",有:"2E7",汤姆:"27V",的:"2S3","的 ":"29E","的时候 ":"2RL",要:"28S"},uniques:{" aan":"d"," aic":"j"," aik":"g"," aiu":"c"," ao ":"b"," aos":"b"," as-":7," até":"b"," auf":9," auz":"j"," aí":"b"," aú":"a"," cee":"j"," chc":"l"," cs":"i"," ctr":"k"," cu ":"j"," cua":"a"," cóm":"a"," daa":"d"," dl":"l"," dzi":"l"," där":"f"," dår":"h"," dés":7," día":"a"," dón":"a"," död":"f"," ea ":"j"," ear":8," eat":8," een":"d"," eft":"f"," elä":"g"," em ":"b"," epl":"h"," etm":"m"," etw":9," ez ":"i"," ezt":"i"," fez":"b"," fi ":"j"," fiq":"b"," fje":"h"," gaa":"d"," gi ":"h"," gic":"f"," gik":"h"," gje":"h"," gân":"j"," göz":"m"," hje":"h"," hoz":"i"," htt":"k"," hv":"h"," há ":"b"," hâl":"m"," hög":"f"," i'":8," i-":"j"," iar":"j"," ied":"d"," iet":"d"," if ":8," iga":"i"," igj":"h"," ihn":9," iht":"m"," ik ":"d"," ilg":"m"," ilm":"g"," ils":7," ily":"i"," isn":8," it'":8," iub":"j"," iy":"m"," iş":"m"," já ":"b"," kje":"h"," ks":"l"," kt":"l"," kuo":"g"," kuu":"g"," kå":"h"," l-":"j"," lh":"b"," lj":"f"," lle":"a"," luu":"g"," lá ":"b"," låt":"f"," m'a":7," m-":"j"," mj":"f"," mni":"l"," muj":"a"," mè":7," n'a":7," n-a":"j"," ne-":"j"," når":"h"," nós":"b"," oam":"j"," ock":"f"," odp":"l"," og ":"h"," ogg":"c"," ogs":"h"," ohn":9," oik":"g"," olh":"b"," olm":"m"," op ":"d"," oth":8," oí":"a"," pe ":"j"," päi":"g"," rz":"l"," s'e":7," s-":"j"," sb":"c"," sd":"c"," sg":"c"," sje":"h"," szc":"l"," szü":"i"," te-":"j"," tiv":"b"," tym":"l"," työ":"g"," täm":"g"," tè":"c"," töb":"i"," tú ":"a"," túl":"i"," ucc":"c"," un'":"c"," uo":"c"," up ":8," usc":"c"," usk":"g"," v-":"j"," veu":7," vri":"d"," vro":"d"," vän":"f"," way":8," wij":"d"," wo ":9," ws":"l"," wur":9," xí":"b"," yh":"g"," yk":"g"," yl":"g"," ym":"g"," yri":"g"," ys":"g"," yü":"m"," za ":"l"," zas":"l"," zaw":"l"," zd":"l"," zi ":"j"," zij":"d"," zm":"l"," zn":"l"," zo ":"d"," zos":"l"," zr":"l"," zu ":9," |":6," ° ":"c"," ½":9," áll":"i"," án":"a"," äls":"f"," än ":"f"," är ":"f"," äta":"f"," äte":"f"," åk":"f"," åp":"h"," åt ":"f"," ça ":7," çal":"m"," ço":"m"," è ":"c"," é ":"b"," ért":"i"," éta":7," été":7," éx":"a"," éé":"d"," ír":"i"," îm":"j"," în":"j"," ôn":"b"," önc":"m"," öpp":"f"," öss":"i"," úg":"i"," új":"i"," ō":9," şe":"m"," şi ":"j"," şt":"j"," ।":6," २":6," ঈ":5," ঋ":5," ঔ":5," ৩":5," ৪":5," ৬":5," ৮":5," ―":"k"," ‟":9," №":"k"," ご":1," ウサギ":1," エレベ":1," コ":1," ジ":1," テ":1," ド":1," ネズミ":1," バ":1," パ":1," フ":1," ボ":1," マ":1," メ":1," 一人":1," 一日":1," 一般的":1," 不好意":2," 両親":1," 中国語":1," 二人":1," 交通事":1," 今 ":1," 今夜":1," 今度":1," 今晩":1," 今朝":1," 今週末":1," 他一":2," 他不":2," 他人":1," 他可能":2," 他在":2," 他把":2," 他有":2," 会議":1," 何時":1," 俺":1," 僕":1," 先週":1," 列車":1," 労働者":1," 北海道":1," 午前中":1," 博物館":1," 合衆国":1," 君":1," 因為":2," 地下鉄":1," 基本的":1," 外国":1," 多分 ":1," 大学":1," 大家":2," 如":2," 子":1," 実際":1," 宿題":1," 富士山":1," 少年":1," 心配":1," 我今":2," 我从来":2," 我从没":2," 我以":2," 我会":2," 我叔叔":2," 我只":2," 我可":2," 我和":2," 我哥哥":2," 我喜":2," 我妹妹":2," 我完全":2," 我就":2," 我希":2," 我弟弟":2," 我必須":2," 我必须":2," 我感觉":2," 我打算":2," 我把":2," 我无法":2," 我明":2," 我昨":2," 我更喜":2," 我最近":2," 我正在":2," 我没":2," 我無法":2," 我父":2," 我爸爸":2," 我現在":2," 我相信":2," 我看":2," 我知":2," 我能":2," 我覺得":2," 我觉":2," 我認為":2," 我认":2," 我讨厌":2," 我需":2," 我非常":2," 所以":2," 所有":2," 放課後":1," 政治家":1," 新聞":1," 旅行":1," 日曜":1," 昨夜":1," 是的 ":2," 時々 ":1," 晩ご飯":1," 最初":1," 最近 ":1," 最近彼":1," 月日":1," 有些人":2," 来週":1," 残念":1," 湯":2," 現在 ":1," 看護婦":1," 私":1," 科学者":1," 突然 ":1," 結婚":1," 結局":1," 萨米":2," 請":2," 警察官":1," 谢谢 ":2," 這":2," 那":2," 電話番":1," 電車":1," 風邪":1," 飛行":1," 갈 ":3," 같":3," 걱정":3," 걸":3," 결국 ":3," 결혼":3," 경찰":3," 계속":3," 곧 ":3," 공":3," 과학":3," 괜찮":3," 궁금":3," 날":3," 남":3," 넌 ":3," 널 ":3," 네":3," 년 ":3," 노래":3," 노력":3," 누":3," 당":3," 대":3," 더":3," 동":3," 돼 ":3," 되":3," 될 ":3," 두 ":3," 둘 ":3," 때":3," 떠났":3," 또 ":3," 많":3," 먹":3," 메":3," 몇 ":3," 모":3," 몰랐":3," 못":3," 문":3," 뭘 ":3," 미":3," 바":3," 방법":3," 배":3," 번역":3," 벌써 ":3," 본 ":3," 볼 ":3," 봐 ":3," 부":3," 비":3," 살":3," 새 ":3," 생":3," 선생":3," 소":3," 싶":3," 알":3," 언":3," 엄청 ":3," 영":3," 오":3," 완전":3," 왜":3," 운전":3," 음식":3," 음악":3," 잘":3," 재미":3," 저":3," 적":3," 전":3," 절대":3," 점심 ":3," 정":3," 조금":3," 좀":3," 죄송":3," 줄 ":3," 중":3," 줘 ":3," 진짜":3," 질문":3," 집":3," 참 ":3," 처음 ":3," 친구":3," 침대":3," 커피":3," 컴퓨":3," 큰 ":3," 텔레비":3," 파티":3," 프":3," 학교":3," 학생":3," 할":3," 함께":3," 항상":3," 행복":3," 훨씬 ":3," -":9,"'ae":"c","'ai ":7,"'aim":7,"'cl":8,"'d ":8,"'da":"m","'e-":"c","'ea":7,"'eb":"c","'ell":7,"'ep":"c","'eq":"c","'fb":"c","'ha ":"c","'ho ":"c","'hu":7,"'il ":7,"'j":"d","'k":"d","'ll":8,"'ni":"m","'on ":7,"'ou":7,"'ov":"c","'re ":8,"'uc":"c","'uf":"c","'ug":"c","'une":7,"'uo":"c","'uv":"c","'ve":8,"'y ":7,"'ye ":"m","'yi":"m","'à":7,"'á":"b","'â":7,"'è ":"c","'é":7,"'ê":7,"'î":7,"'ü":"m","(-":"k","(q":"b","(y":"a","(z":9,"-$":"n","-'":"m","-ai ":"j","-am ":"j","-ar ":"j","-au ":"j","-ce ":7,"-ell":7,"-il ":7,"-je ":7,"-l ":"j","-lh":"b","-lo ":"b","-là":7,"-me ":"b","-mi ":"j","-moi":7,"-t-":7,"-tu ":7,"-ul":"j","-vou":7,"-à":7,"-ã":"b","-ê":7,"-í":"b","-ó":"i","-ö":"i","-ş":"j","a'd":"m","a'y":"m","aag ":"d","aak ":"d",aakt:"d","aam ":"d",aav:"g",abg:9,acj:"l",acz:"l",adei:"b",afí:"a",agte:9,"agy ":"i",ahd:"g","ahr ":9,aike:"g",aior:"b","ais-":7,aiut:"c",aixo:"b",ajud:"b",alál:"i",amay:"m",ambé:"b","an't":8,apm:"m",aquí:"a",ardz:"l",areb:"c",arfö:"f",arum:9,arü:9,arş:"m",aszt:"i",atok:"i",atât:"j",aufe:9,augh:8,auj:7,autt:"g",avea:"j",avev:"c",avne:"h",avve:"c",avô:"b",ayac:"m",ayud:"a",ayó:"a",azla:"m","azt ":"i",azón:"a",azú:"a",aá:"i",aã:"b",aä:"g",aî:7,aö:"i",aún:"a",baix:"b",baş:"m",berä:"f",besz:"i",bge:9,"biz ":"m",bién:"a",blij:"d","bly ":8,brz:"l",brí:"a","bst ":9,buie:"j",bunu:"m",buon:"c",buu:"d","bym ":"l",bã:"b",bäs:"f",bäu:9,"bè ":"c",bém:"b","bí ":"a","bía ":"a",bî:7,bô:"b",börj:"f",bù:"c",büc:9,"c'es":7,"c'è":"c",cche:"c",ccia:"c",cció:"a",ceea:"j",cepu:"j",chce:"l",chg:9,chk:9,chod:"l",chä:9,chí:"a",chö:9,chü:9,ciod:"j",ciun:"j",ciut:"c",cji:"l",ckan:"f",cma:"j",cois:"b",coj:"a",colh:"b",conh:"b","cos'":"c",csa:"i",cse:"i",csi:"i",cuan:"a",cuch:"a",cuel:"a",cuen:"a",cug:"c",cuie:"j",cuol:"c",cuá:"a","cz ":"l",czas:"l","cze ":"l",czeg:"l",czek:"l",czn:"l",czo:"l",czu:"l",czy:"l",câi:"j",câm:"b",cât:"j",cã:"b",cä:9,cç:"b",cên:"b","cí ":"a","d'h":7,"d'v":8,"d'è":"c","d)":8,daag:"d",daar:"d",daq:"b",davv:"c",daví:"a",daş:"m",ddl:8,degl:"c",deia:"b",dein:9,deir:"b","deu ":"b",deut:9,dey:"m",didn:8,dijo:"a",dinh:"b",dly:8,"dn'":8,"don'":8,dovr:"c",dovu:"c",drik:"h",drz:"l",drí:"a",drü:9,"dta ":"i",dtam:"i","du-":"j",duw:"d",duy:"m","dzi ":"l",dzia:"l",dzie:"l",dzis:"l",dzo:"l",dzy:"l",dà:"c","dá-":"b",dã:"b","dä ":"g","dän ":"g",dät:"g","då ":"f",dål:"f",dè:7,dép:7,dê:"b","dí ":"a","día ":"a",días:"a",dîn:7,dô:"b",dörr:"f",dúv:"b",dû:7,"dü ":"m","dün ":"m",dō:9,"e'r":8,"e'v":8,eady:8,easc:"j",eaun:"j",eave:8,ebè:"c",ecek:"m",eceu:"b",ecir:"a",ecv:"j",ediy:"m",edzi:"l","eea ":"j",eeft:"d",efd:"d",egou:"b",egé:"i","ehe ":9,"ehr ":9,ehs:9,"eht ":9,einm:9,"eio ":"b",eix:"b",ejor:"a",ejó:"a","ekk ":"h",elbs:9,eliy:"m",ellä:"g",elq:7,emey:"m",emiy:"m",emps:7,"emu ":"l","en't":8,enx:"b",enía:"a",eopl:8,eoz:"c",epoi:"b",epui:7,erug:"d","es-t":7,"es-v":7,"esc ":"j",esoi:7,eszc:"l",euch:9,eux:7,"ev'":"c",evn:"h",ewh:8,eyec:"m","eyi ":"m","ezt ":"i",ezte:"i",ezza:"c",ezó:"a",eã:"b","eä ":"g",eça:"b","eço ":"b",eë:"d","eí ":"a",eía:"a",eíb:"a",eíd:"a",eî:"j",eïn:"d",eón:"a",eû:7,"e‘":9,"fa'":"c",fap:"j",faut:7,fazl:"m","fd ":"d","fde ":"d",fds:"d",feel:8,fej:"i",few:8,ffn:9,fft:9,fiec:"j",figl:"c",fikk:"h",filh:"b",flé:7,foar:"j",fois:7,forh:"h",frum:"j",frå:"f",frè:7,frü:9,fuer:"a",fuo:"c",fà:"c",fâr:"j",fã:"b",fäh:9,fåg:"f",fç:"m","fè ":"c",fèr:7,fía:"a",fô:"b",förs:"f",förä:"f",fû:7,füh:9,"g)":8,gaat:"d",ganh:"b",gdy:"l",gdz:"l",gece:"m",geef:"d",geht:9,gesa:9,geï:"d",ggh:"c","ggi ":"c",ggia:"c",ggs:8,ghb:8,ghl:8,giap:"c",gick:"f",gikk:"h",gioc:"c",giov:"c",gitm:"m",gjer:"h",glei:9,glez:"j",glio:"c",glöm:"f",glü:9,goed:"d",gof:"c",good:8,"gou ":"b",gråd:"h",grü:9,gså:"h",gth:8,guf:"c",guma:"b",guv:"j",gye:"i",gyi:"i",gynn:"h",gynt:"h",gyo:"i",gysz:"i","g ":9,gând:"j",gã:"b",gåe:"h",gån:"f",gè:7,gée:7,gía:"a",görm:"m",görü:"m",gù:"c","gún ":"a","gün ":"m",güz:"m","h)":9,hace:"a",haci:"a",hagy:"i",hci:"l",hdä:"g","he'":8,hear:8,hebb:"d","hed ":8,heef:"d","hey'":8,hiam:"c","hij ":"d",hijo:"a",hjem:"h",hjer:"h",hlen:9,hlt:9,hly:8,hlä:9,hnen:9,hnl:9,"ho'":8,hodz:"l",hogy:"i",homb:"a",houd:"d",houg:8,hoy:"a","hoz ":"i",hoş:"m",hrer:9,hrh:9,hrl:9,hrs:9,hrt:9,"hst ":9,http:"k",htä:"g",huo:"g",huvu:"f",huw:"d",hvé:"a",hyv:"g",hár:"i",hã:"b","hän ":"g",häne:"g","här ":"f",hål:"f",hån:"h",håp:"h",hç:"m","hí ":"a",hís:"a",hív:"i",hô:7,höv:"f",hō:9,hş:"m","h‘":9,"i'l":8,"i'm":8,"i'v":8,iacc:"c",iagg:"c",iapp:"c",ibt:9,icz:"l",idzi:"l",idä:"g","iec ":"l",iedy:"l",iedz:"l","iej ":"l",iejs:"l",ielä:"g",igje:"h",igk:9,igvi:"h",igå:"f","ihm ":9,ihmi:"g","ihn ":9,"ihr ":9,ihå:"f",iic:"j",iik:"g",iim:"g","iin ":"g",ijb:"d",ijd:"d",ijf:"d",ijg:"d",ijh:"d","ijk ":"d",ijke:"d","ijn ":"d",ijp:"d",ijt:"d",ijv:"d",ijz:"d",iliy:"m",ilye:"i",incs:"i",inál:"i",iní:"b",ioda:"j",ious:8,ioè:"c",irim:"m",irj:"g",irkl:9,"is-j":7,issz:"i",isä:"g","it's":8,"iu-":"b",iua:"j",iuc:"c",iune:"j",iuo:"c",iusc:"c",iuto:"c",ivät:"g",ixar:"b",iye:"m",iyi:"m",iyo:"m",izio:"c",ià:"c",iã:"b","iä ":"g",iça:"b",iço:"b",ièm:7,iée:7,"ién ":"a",iê:"b",ië:"d",ií:"i",iô:"b",iù:"c",iü:"i","iş ":"m",işe:"m",işi:"m","j'":7,"j-":"i",jaar:"d","jag ":"f",jahr:9,jds:"d",jdt:"d",jedz:"l","jeg ":"h",jego:"l",jelp:"h",jert:"h",jetz:9,jeun:7,"jf ":"d",jft:"d","jg ":"d",jge:"d",jgt:"d",jij:"d",jj:"i",jkh:"d",jks:"d",jkt:"d","jl ":"d",jls:"d",jnl:"d",jns:"d",jnt:"d",joit:"g",jota:"g",joue:7,"jp ":"d",jpe:"d",jpt:"d",jull:"d",juo:"g",juu:"g",jze:"d",jzi:"d",jà:7,jár:"i",ját:"i",jã:"b","jä ":"g",jälv:"f",jå:"h","jé ":"a",jól:"i","kaa ":"g",kauf:9,kijk:"d",kims:"m",kiş:"m",kjed:"h",kjel:"h",kjem:"h",kjen:"h",kjer:"h",kkä:"g",knew:8,know:8,kolm:"g",komt:"d",ksj:"h",kså:"f",kuin:"g",kvel:"h",kvä:"f",kâ:"m","kä ":"g",känd:"f",käv:"g",kåt:"h",kç:"m",kép:"i",kér:"i",kés:"i",két:"i","kö ":"g",köny:"i",köz:"i",kú:"i",kû:"m",kō:9,kş:"m","l'f":"c",laub:9,laş:"m",lbst:9,lcos:"c",lcun:"c","ldu ":"m",left:8,letz:9,"lf-":8,lfd:"d",lgd:"d",lgoz:"i",lgui:"a",lgum:"b",lgú:"a",ligv:"h",lijk:"d",liw:"l",lkä:"g","ll'a":"c","ll'e":"c","llä ":"g",lmay:"m",lmiy:"m",lox:"c",lsj:"d",ltc:"j",ltij:"d",ludz:"l",lvf:"h",lví:"a",lway:8,lyck:"f","lz ":9,lâng:"j",lã:"b",lära:"f",låd:"f",låg:"f","låt ":"f",lè:7,lên:"b","lí ":"a",lía:"a",lû:7,"m'u":"m","m'è":"c","m-v":"b",mawi:"l",mbié:"a","mdi ":"m",megt:"i",megy:"i",mehr:9,meir:"b",mejo:"a",melh:"b",meye:"m",meyi:"m",miei:"c",migh:8,migl:"c",mijn:"d","miz ":"m",miè:7,miş:"m",mjö:"f",mmt:9,mmä:"g","mo-":"b",moet:"d",moje:"l",mq:"c",mulh:"b",muut:"g","muy ":"a",myck:"f",mye:"h",myö:"g","m ":"b",mâi:"j",mânc:"j",mã:"b","mä ":"g",mås:"f",måte:"h",mèr:7,mée:7,mêm:7,"mí ":"a",mía:"a",mój:"l",möc:9,mún:"a",mû:7,müss:9,mş:"m","n'ai":7,"n'd":"m","n't ":8,"n'y":7,"n'è":"c",nagy:"i",namn:"f",nauc:"l",nció:"a",nehm:9,neue:9,next:8,nft:9,nfí:"a",nhec:"b","nho ":"b",nhv:"h",niej:"l",niin:"g",niy:"m",niè:7,nká:"i",nly:8,nnhe:"h",nnr:"h",nnsk:"h",nnst:9,"nnt ":9,nnte:9,nnå:"h",nodi:"d",nooi:"d",noth:8,nouv:7,"now ":8,noë:7,"nq ":7,nskj:"h","nu-":"j",nuev:"a",nung:9,nuov:"c",nuw:"d",nuş:"m",nvän:"f",nych:"l",nyel:"i",nyth:8,nyv:"i",nyá:"i","nz'":"c",nzio:"c","n­":9,"nál ":"i",nã:"b","nä ":"g",näi:"g",näk:"g",någ:"f","når ":"h",nçai:7,nças:"b",nè:7,née:7,nék:"i",néz:"i","nía ":"a",níc:"b","nós ":"b",nù:"c",nş:"m","n‘":9,"o'c":8,obú:"a",ocm:"j",ocui:"j",ocuk:"m",ocz:"l",odob:"l",odpo:"l",odzi:"l",oede:"d",oeg:"d",oek:"d",oesn:8,oew:"d",ofd:"d",oike:"g",oitt:"g",oiu:"j",oix:7,ojc:"l",ojeg:"l",olur:"m",omú:"a",onnt:9,ooit:"d",opd:"d",opg:"d",oruz:"m",osaa:"g",ossz:"i",otde:"j","ou'":8,ough:8,oujo:7,ould:8,ourq:7,ourr:7,ouw:"d",oué:7,"ov'":"c",ovre:"c",ovv:"c","ow'":8,owd:8,"owi ":"l",oyf:8,oyn:"m",oyé:7,ozw:"l",oã:"b",oå:"f",oça:"b",oço:"b","oè ":"c",oël:7,oír:"a",oî:7,oó:"b",où:7,oû:7,"o₂":9,palj:"g",panh:"b",paur:"c",peak:8,pegn:"c",peop:8,peó:"a","pf ":9,pfl:9,pge:"d",piè:7,pmak:"m",pmay:"m","po'":"c",poat:"j",pouv:7,powi:"l",prek:"d",prz:"l",prè:7,pued:"a",puhu:"g",puoi:"c",pués:"a",pyta:"l",pà:"c",pâi:"j",pã:"b",pè:7,pée:7,péu:"b",pôd:"b",pş:"m","q-":"i",qq:"c","qu'":7,qur:8,"quí ":"a","r-o ":"j",raag:"d",rawd:"l","re's":8,"ren'":8,reí:"a",rför:"f",rgd:"d",rijk:"d","rió ":"a",rjoi:"g",rkj:"h",rlf:8,rly:8,rmí:"a",rodz:"l",roun:8,"row ":8,rquo:7,rrow:8,rske:"h",rskj:"h",rsoa:"j",rsq:7,rsök:"f",ruik:"d",ruke:"h",rvä:"f",rykk:"h",rzt:9,rzy:"l","r­":9,rà:"c","rá-":"b",râd:"j",râs:"j",rã:"b",räff:"f",räg:9,räu:9,råg:"f",rån:"f","rè ":"c",rèr:7,"rí ":"a",rías:"a",rív:"b",rôl:7,rù:"c",rû:7,rō:9,"s'es":7,"s'il":7,"s's":8,"s'è":"c","saa ":"g",saan:"g",says:8,saí:"b",saú:"b",sciu:"c",scuc:"a",segí:"i",sehr:9,selb:9,setz:9,"seu ":"b",seul:7,"she ":8,shed:8,shl:8,shr:8,sicu:"c",siin:"g",siit:"g",siy:"m","siz ":"m",siä:"g",siè:7,sión:"a",sjuk:"f",sjö:"f",skje:"h",sks:8,"sn'":8,snil:"h",snö:"f",soas:"b",sotr:"a",spué:"a",ssoa:"b",ssza:"i",ssze:"i",suno:"c",suoi:"c",suur:"g",svå:"f",syy:"g",syö:"g",szab:"i",szik:"i",szy:"l",szá:"i",szé:"i",szí:"i",szül:"i","s­":9,sà:"c",sári:"b","sä ":"g",såd:"f",såg:"f",sè:7,sée:7,ség:"i",sê:"b","sí ":"a",sív:"b",sólo:"a",sô:"b",söy:"m",sù:"c",sû:7,süre:"m","t'v":8,"t'è":"c","t-ce":7,"t-il":7,"t-o ":"j","taa ":"g",tasj:"h",tci:"j",tdea:"j",teir:"b",temt:"h",tení:"a",tept:"j","teu ":"b",tfen:"m",thd:8,they:8,thre:8,tidl:"h",tilb:"h",tinh:"b",tiy:"m",tiè:7,tjen:"h",tly:8,tmek:"m",tmey:"m",tné:"i",toar:"j","tog ":"f",touj:7,tq:9,"tr-":"j",trl:"k",trz:"l",träd:"f",trè:7,ttaa:"g",ttè:"c",tuom:"g",tuvo:"a",tué:7,tvä:"f",två:"f","ty-":8,tylk:"l",tyy:"g","tze ":9,tzl:9,"tzt ":9,tzte:9,tzu:9,tà:"c","tá-":"b","tál ":"i",táx:"b",tâi:"j",tâl:"j",tâmp:"j",târ:"j","tât ":"j",tã:"b","tä ":"g",täi:"g",tåg:"f",tç:"m","tè ":"c",tée:7,ték:"i","tél ":"i",têm:"b",tên:"b","tí ":"a",tío:"a","tól ":"i",tóq:"b",tù:"c","tü ":"m","tün ":"m",tünk:"i",tō:9,"t‘":9,"u'a":7,"u'e":7,"u'i":7,"u'l":8,"u'o":7,"u'r":8,"u'u":7,"u'v":8,"u-i":"j","u-mi":"j",ualc:"c",uap:"a",uase:"b",ucru:"j",ucz:"l",udc:"c",udom:"i",udzi:"l",uede:"a",uego:"a",ueva:"a",uevo:"a",ufen:9,ufg:9,ufz:9,ught:8,ugü:"m",uii:"c",uink:"g",uiu:"b",uién:"a",uió:"a",ujb:"j",ujer:"a",ukaa:"g",umg:9,umne:"j","unn ":"h",unns:"h",unuz:"m",uoc:"c",uog:"c","urd'":7,ureu:7,urü:9,used:8,usst:9,uude:"g",uul:"g","uur ":"d",uuri:"g",uuta:"g",uutt:"g",uvez:7,"uvo ":"a",uvé:7,"uw ":"d",uwd:"d",uws:"d",uwt:"d","ux-":7,uyd:"m",uyor:"m",uyu:"m",uyó:"a",uán:"a",uã:"b",uä:9,uè:7,uée:7,"uém ":"b",uên:"b",uó:"a",uşu:"m","v'e":"c","v'è":"c","v-a":"j","vaa ":"g",vagy:"i",vaik:"g",való:"i",varf:"f","vec ":7,veie:"h",very:8,vesz:"i",veva:"c","vez-":7,vgj:"h",vij:"d",vió:"a","vn ":"h",vnet:"h",voas:"j",vogl:"c",voln:"i",voor:"d",votr:7,"vou ":"b",voul:7,vreb:"c",vreo:"j",vroe:"d",vrou:"d",vuel:"a",vuoi:"c",vuol:"c",vuto:"c",vver:"c",vvo:"c",vz:"m",vâr:"j",vã:"b","vä ":"g",väg:"f",väh:"g",väld:"f",vänd:"f","vät ":"g","vå ":"f",våk:"h",vån:"f",vè:7,vée:7,"vía ":"a",vî:7,"vô ":"b",vú:"i",vş:"m","w's":8,waar:"d",wahr:9,wasn:8,wav:8,ways:8,wcz:"l","we'":8,wea:8,weer:"d",weh:9,wf:8,whe:8,why:8,wia:"l",widz:"l",wiec:"l",wiek:"l",wiem:"l","wil ":"d","wir ":9,wird:9,wirk:9,with:8,"wl ":8,wly:8,woh:9,woi:"l",woj:"l","won'":8,woon:"d",woor:"d",woul:8,wró:"l",wsz:"l",wurd:9,wv:"d",www:"c",wyc:"l",wye:8,wyg:"l",wyj:"l",wyk:"l",wym:"l",wyp:"l",wys:"l",wz:"l",wá:"a",wä:9,wó:"l",wö:9,wü:9,xad:"b",xb:"i","xe-":"b",xed:8,xei:"b",xg:9,xk:9,xm:9,xou:"b",xr:"i",xs:9,xz:9,xã:"b",xíc:"b",xō:"a","y'l":8,"y'n":"m","y'r":8,"y'v":8,"y'y":"m",yaca:"m",yapt:"m",yaş:"m",yby:"l",yci:"l",ycka:"f",ycke:"f",yckl:"f",ycz:"l","ydi ":"m",yea:8,yece:"m",yeu:7,yfr:8,ygd:"h",yhd:"g",yht:"g","yim ":"m",yiy:"m",ykd:"h",ymr:"h",ynyt:"g",yord:"m",yoru:"m",your:8,yrit:"g",ythi:8,ytä:"g",yvin:"g",ywh:8,yâ:"m",yä:"g",yí:"i",yō:9,"z'a":"c","z'o":"c","z-v":7,zaws:"l",zco:"a",zcz:"l",zego:"l",ziec:"l",ziej:"l","zij ":"d",zijn:"d",zinh:"b",ziy:"m","zla ":"m",zoe:"d",zond:"d",zost:"l",zott:"i",zq:"a",zro:"l",ztá:"i",zuu:"d",zwei:9,zyb:"l",zyc:"l",zyj:"l",zyma:"l",zys:"l",zyt:"l",zyw:"l","zz'":"c","zzo ":"c",zzá:"i",zám:"i",zâm:"j",zã:"b",zä:9,zê:"b",zô:"b",zúc:"a","| ":6," =":9," i":9," p":7," u":9," w":"l"," z":"l",ª:"b","­b":9,"­d":9,"­s":9,"²'":"m","· ":"e",ºc:"a","½ ":9,ß:9,"à-":7,àq:"b",às:"b","à ":7,"á'":"i","á-l":"b",áa:"i",ább:"i","ád ":"i","ág ":"i",água:"b",áis:"a",ák:"i",áln:"i",álta:"i","ám ":"i",ána:"i",ány:"i",áo:"i","ár ":"i","ára ":"i",ário:"b",áro:"i",áso:"i","ást ":"i",ásá:"i","át ":"i",áts:"i",átt:"i",ável:"b",áy:"a",áá:"i",áé:"i",áí:"i",áó:"i",áú:"i",áü:"i","â ":"m",âc:7,âg:7,âh:"m","âi ":"j",âin:"j",âk:"m",âln:"j",âmpl:"j",ânca:"j","ând ":"j",ânz:"j",ârs:"j",ârt:"j",ârz:"j","âs ":"j",âu:"j",ây:"m","ã ":"b","ã-":"b",ãe:"b",ãos:"b",ãs:"b",ãz:"b","ä-":"g",äa:"g",äch:9,ädc:9,ädd:"f",äffa:"f",äga:"f",ägg:"f",ägt:9,ähd:"g",ähl:9,ähr:9,ähä:"g",äin:"g",äisi:"g",äit:"g",äiv:"g",äj:"g",äks:"g",äkt:"f",äkä:"g","äl ":"f",äldi:"f","äll ":"f",ällä:"g",älp:"f",älsk:"f","älv ":"f",älä:"g",ämn:"f",ämä:"g",ända:"f",änel:"g","äni ":"g",äny:"g",änä:"g",äq:9,ärn:"f","äsi ":"g",ästa:"f","äta ":"f","ätt ":"f",ätta:"f",ätz:9,ätä:"g",äuf:9,äum:9,ävi:"g",ävä:"g",äx:"f",äy:"g",äz:9,ää:"g",äö:"g",åa:"f",åb:"f",åda:"f",ådi:"h",åel:"h","åg ":"f",åga:"f",åge:"f",ågo:"f",ågr:"f",åh:"f",åka:"f",åkt:"f",åla:"f",åll:"f",åm:"f","ån ":"f",åna:"f",åned:"h",ång:"f",ånn:"h",åpn:"h",åra:"f","åre ":"h",årl:"h",årn:"h",åste:"f",åta:"f","åte ":"h",åtte:"h",åvi:"h",æ:"h","ç ":"m","ç'":"m","ças ":"b",çb:"m",çe:"m",çg:"m",çi:"m",çk:"m",çl:"m",çm:"m",çoc:"m",çok:"m",ços:"b",çou:"b",çr:"m",çs:"m",çt:"m",çy:"m",çá:"b",çã:"b",çç:"m",çó:"b",çö:"m",çú:"b",çü:"m",èb:7,èc:7,èd:7,èg:7,èl:7,èq:7,ès:7,èt:7,èv:7,"è ":"c","é'":"i",écl:7,écou:7,écr:7,ées:7,éfé:7,"ég ":"i","ék ":"i",éke:"i",élet:"i",éln:"i",éno:7,ény:"i",énz:"i","ért ":"i",ész:"i","ét ":"i",étai:7,étud:7,"été ":7,"éu ":"b",éâ:7,éç:7,één:"d",éü:"i","ê ":"b","ê-":"b",êb:"b",êc:7,êl:7,"êm ":"b","ême ":7,ênc:"b",ênd:"b",êni:"b",êp:7,ês:"b",êt:7,êu:"b",êv:7,êx:"b",ëe:"d",ëi:"d",ën:"d",ër:"d",ëz:"d",ì:"c","í-":"b",ían:"a",ík:"i",íng:"b","ío ":"a",íos:"a",íss:"b",íç:"b","î ":"m",îc:7,îi:"j","îl ":"j",îmb:"j",îmi:"j",împ:"j","în ":"j",înc:"j",înd:"j",înf:"j",îng:"j",înn:"j",înr:"j",îns:"j",înt:"j",înv:"j",ît:7,îş:"j",ïf:7,ïnt:"d",ñ:"a",ò:"c","ó-":"i",óa:"i",ócu:"b",óe:"i",óh:"i","ój ":"l","ólo ":"a","ómo ":"a",ónd:"a",óo:"i",ópr:"b",óry:"l",óu:"i",ów:"l",óá:"i",óé:"i",óí:"i",ôni:"b",ôp:7,ôq:"b",ôr:"b",ôs:"b",ôt:7,ôv:"b",õ:"b",öbb:"i",öch:9,öda:"f",öe:9,ögon:"f",öhn:9,öi:"g",öjd:"f",öjl:"f",önce:"m",önnt:9,öo:"g",öra:"f",örja:"f",örsö:"f",örté:"i",össz:"i",ötü:"m",öw:9,öyle:"m",öä:"g",öç:"m",öö:"g",öş:"m",ø:"h","ú-":"i",úe:"a",úgy:"i",úi:"i","új ":"i",úk:"i",úo:"a",úvi:"b",úy:"a","û ":7,ûl:7,ûr:7,ût:7,"ü'":"m",üch:9,ück:9,üen:"a",ühl:9,ühr:9,ünf:9,"ünk ":"i",ünm:"m",ünü:"m",ütf:"m",ütz:9,ütü:"m",üy:"m","üz ":"m",üç:"m",üé:"a",üí:"a",üş:"m",ā:8,ă:"j",ą:"l",ć:"l",ę:"l",ğ:"m","ī ":9,ı:"m",ł:"l",ń:"l","ō ":9,ōb:9,ōc:"a",ōg:9,ōk:9,ōs:9,ōt:9,ő:"i",œ:7,ś:"l","ş'":"m",şam:"m",şan:"m",şar:"m",şb:"m",şek:"m",şey:"m",şf:"m",şg:"m",şh:"m","şi-":"j",şim:"m",şk:"m",şl:"m",şm:"m",şr:"m",şs:"m",ştu:"m",şv:"m",şy:"m",şç:"m",şö:"m",şü:"m",şş:"m",š:"g",ţ:"j",ū:9,ű:"i",ź:"l",ż:"l",ș:"j",ț:"j","́":"k","̇":"m","΄":"e",ΐ:"e",ά:"e",έ:"e",ή:"e",ί:"e",α:"e",β:"e",γ:"e",δ:"e",ε:"e",ζ:"e",η:"e",θ:"e",ι:"e",κ:"e",λ:"e",μ:"e",ν:"e",ξ:"e",ο:"e",π:"e",ρ:"e",ς:"e",σ:"e",τ:"e",υ:"e",φ:"e",χ:"e",ψ:"e",ω:"e",ϊ:"e",ό:"e",ύ:"e",ώ:"e",а:"k",б:"k",в:"k",г:"k",д:"k",е:"k",ж:"k",з:"k",и:"k",й:"k",к:"k",л:"k",м:"k",н:"k",о:"k",п:"k",р:"k",с:"k",т:"k",у:"k",ф:"k",х:"k",ц:"k",ч:"k",ш:"k",щ:"k",ъ:"k",ы:"k",ь:"k",э:"k",ю:"k",я:"k",ё:"k",ѣ:"k","ְ":"n","ֱ":"n","ֲ":"n","ִ":"n","ֵ":"n","ֶ":"n","ַ":"n","ָ":"n","ֹ":"n","ֻ":"n","ּ":"n","ֽ":"n","־":"n","ׁ":"n","ׂ":"n",א:"n",ב:"n",ג:"n",ד:"n",ה:"n",ו:"n",ז:"n",ח:"n",ט:"n",י:"n",ך:"n",כ:"n",ל:"n",ם:"n",מ:"n",ן:"n",נ:"n",ס:"n",ע:"n",ף:"n",פ:"n",ץ:"n",צ:"n",ק:"n",ר:"n",ש:"n",ת:"n","׳":"n","״":"n","،":"o","؛":"o","؟":"o",ء:"o",آ:"o",أ:"o",ؤ:"o",إ:"o",ئ:"o",ا:"o",ب:"o",ة:"o",ت:"o",ث:"o",ج:"o",ح:"o",خ:"o",د:"o",ذ:"o",ر:"o",ز:"o",س:"o",ش:"o",ص:"o",ض:"o",ط:"o",ظ:"o",ع:"o",غ:"o",ـ:"o",ف:"o",ق:"o",ك:"o",ل:"o",م:"o",ن:"o",ه:"o",و:"o",ى:"o",ي:"o","ً":"o","ٌ":"o","ٍ":"o","َ":"o","ُ":"o","ِ":"o","ّ":"o","ْ":"o","٠":"o","١":"o","٩":"o",ٱ:"o",ک:"o",ی:"o","ँ":6,"ं":6,"ः ":6,अ:6,आ:6,इ:6,ई:6,उ:6,ऊ:6,ए:6,ऐ:6,ऑ:6,ओ:6,औ:6,क:6,ख:6,ग:6,घ:6,च:6,छ:6,ज:6,झ:6,ट:6,ठ:6,ड:6,ढ:6,ण:6,त:6,थ:6,द:6,ध:6,न:6,प:6,फ:6,ब:6,भ:6,म:6,य:6,र:6,ल:6,व:6,श:6,ष:6,स:6,ह:6,"़":6,"ा":6,"ि":6,"ी":6,"ु":6,"ू":6,"ृ":6,"ॅ":6,"े":6,"ै":6,"ॉ":6,"ो":6,"ौ":6,"्":6,"०":6,"१":6,"२ ":6,"५ ":6,"९":6,"ঁ":5,"ং":5,অ:5,আ:5,ই:5,উ:5,এ:5,ঐ:5,ও:5,ক:5,খ:5,গ:5,ঘ:5,ঙ:5,চ:5,ছ:5,জ:5,ঝ:5,ঞ:5,ট:5,ঠ:5,ড:5,ঢ:5,ণ:5,ত:5,থ:5,দ:5,ধ:5,ন:5,প:5,ফ:5,ব:5,ভ:5,ম:5,য:5,র:5,ল:5,শ:5,ষ:5,স:5,হ:5,"়":5,"া":5,"ি":5,"ী":5,"ু":5,"ূ":5,"ৃ":5,"ে":5,"ৈ":5,"ো":5,"ৌ":5,"্":5,"ৎ":5,"০":5,"১":5,"২":5,"৩ ":5,"৪ ":5,"৫":5,"৬ ":5,"৭":5,"৮ ":5,"৯":5,ก:4,ข:4,ค:4,ง:4,จ:4,ฉ:4,ช:4,ซ:4,ญ:4,ฎ:4,ฏ:4,ฐ:4,ณ:4,ด:4,ต:4,ถ:4,ท:4,ธ:4,น:4,บ:4,ป:4,ผ:4,ฝ:4,พ:4,ฟ:4,ภ:4,ม:4,ย:4,ร:4,ฤ:4,ล:4,ว:4,ศ:4,ษ:4,ส:4,ห:4,ฬ:4,อ:4,ฮ:4,ะ:4,"ั":4,า:4,ำ:4,"ิ":4,"ี":4,"ึ":4,"ื":4,"ุ":4,"ู":4,เ:4,แ:4,โ:4,ใ:4,ไ:4,ๆ:4,"็":4,"่":4,"้":4,"๊":4,"๋":4,"์":4,ὰ:"e",ὸ:"e","​e":"d","​v":"d","​y":"m","‌":5,"‏":"o","― ":"k","‘ ":9,"‘s":"d","‚":9,"‟ ":9,"‬":"o","‮":"o"," °":9,"№ ":"k","−":9,あ:1,い:1,う:1,え:1,お:1,か:1,が:1,き:1,く:1,け:1,こ:1,さ:1,し:1,じ:1,す:1,せ:1,そ:1,た:1,だ:1,ち:1,っ:1,つ:1,て:1,で:1,と:1,ど:1,な:1,に:1,ね:1,の:1,は:1,ば:1,へ行:1,べ:1,ま:1,み:1,め:1,も:1,ゃ:1,や:1,よ:1,ら:1,り:1,る:1,れ:1,ろ:1,わ:1,を:1,ん:1,ア:1,イ:1,オオカミ:1,カナダ:1,カ合衆国:1,キャプテ:1,ク:1,シャ:1,ジャ:1,ジョ:1,ス:1,タバコ:1,チョコ:1,ッ:1,ティ:1,テレ:1,ディズニ:1,ト:1,ニュ:1,プレゼ:1,プロジェ:1,ミュニケ:1,ム:1,ラ:1,リ:1,ル:1,レビ:1,ン:1,"・・・":1,ー:1,一下:2,一度:1,一日中:1,"一本書 ":2,一生懸:1,一番:1,一緒:1,一起:2,一週間:1,上げ:1,上手:1,"下雨 ":2,不会:2,不可能的:2,"不在家 ":2,不思議:1,不想:2,不是:2,不注意:1,不知:2,不能:2,不要:2,世界一周:1,世界上:2,世界中:1,世界大戦:1,世界平和:1,"东西 ":2,个:2,中華料理:1,为:2,丽:2,么:2,之:2,也:2,书:2,"了 ":2,了一:2,了他:2,了我:2,事務所:1,二次世界:1,交通渋滞:1,人々:1,人間:1,什:2,今天:2,"今日 ":1,仕事:1,"他 ":2,他是:2,他的:2,们:2,"任何人 ":2,会社:1,但:2,住在:2,"作 ":2,你:2,來:2,"個問題 ":2,"個小時 ":2,們:2,"候 ":2,做:2,儿:2,冷蔵庫:1,出発:1,到了:2,勉強:1,動車事故:1,医者:1,"去 ":2,"去学校 ":2,友達:1,发:2,可以:2,可俗話又:2,"可能的 ":2,名前:1,"名字 ":2,吗:2,吧:2,告诉:2,"呢 ":2,"咖啡 ":2,哪:2,"啊 ":2,嗎:2,"回家 ":2,図書館:1,在波士頓:2,在波士顿:2,"地方 ":2,"多少錢 ":2,"多少钱 ":2,大丈夫:1,大統領:1,天早上:2,天然資源:1,她:2,"好 ":2,好的:2,如果:2,姆:2,委員会:1,子供:1,"学习 ":2,学校へ:1,学生時代:1,孩:2,學:2,它:2,宇宙飛行:1,宙飛行士:1,家族:1,对:2,對:2,就是:2,工作:2,"巧克力 ":2,已:2,庁所在地:1,应该:2,开:2,弁護士:1,彼女:1,很:2,怎:2,息子:1,您:2,想要:2,"意思 ":2,"感兴趣 ":2,懸命勉:1,"我 ":2,我々:1,我一:2,我不:2,我在:2,我希望:2,我想:2,我是:2,我有:2,我的:2,我第一次:2,我要:2,我觉得:2,我需要:2,"房子 ":2,所有的:2,手伝:1,手紙:1,"打網球 ":2,打電話給:2,携帯電話:1,日本語:1,早寝早起:1,时:2,明天:2,明日:1,映画:1,昨天:2,昨日:1,是一:2,是不:2,"是多少 ":2,是我:2,時候:2,時間以上:1,晚:2,曜日:1,會:2,有一:2,有人:2,朋:2,本当:1,"来的 ":2,"東西 ":2,样:2,欢:2,歡:2,殺人事件:1,毎日:1,每:2,民主主義:1,気:1,汤:2,沒:2,没有:2,"波士頓 ":2,"波士顿 ":2,海外旅行:1,"游泳 ":2,澳大利亚:2,现:2,生懸命:1,"生活 ":2,的东西:2,的事:2,的人:2,的名字:2,"的問題 ":2,"的国家 ":2,的地方:2,"的城市 ":2,"的女人 ":2,"的想法 ":2,的房子:2,"的房間 ":2,"的故事 ":2,"的照片 ":2,"的話 ":2,"看电视 ":2,看起来:2,"看電視 ":2,県庁所在:1,真的:2,知道:2,私達:1,科学技術:1,第二次世:1,約束:1,经:2,给:2,而:2,自分:1,自動車:1,自己的:2,自己紹介:1,自転車:1,"色的 ":2,行方不明:1,裡:2,西班牙:2,见:2,言葉:1,計画:1,試験:1,誕生日:1,說:2,読む価値:1,话:2,语:2,说:2,请:2,跟:2,车:2,过:2,还:2,这:2,這個:2,運転:1,部屋:1,郵便局:1,"里 ":2,"重要 ":2,重要的:2,間違:1,"问题 ":2,间:2,電話番号:1,音楽:1,飛行機:1,高校時代:1,高速道路:1,麼:2,點:2,가:3,거:3,"건 ":3,"걸 ":3,것:3,게:3,"계속 ":3,고:3,"과 ":3,그:3,기:3,"까 ":3,나:3,난:3,내:3,너:3,"네 ":3,는:3,니:3,다:3,"더 ":3,"데 ":3,도:3,"든 ":3,들:3,라:3,로:3,를:3,리:3,마:3,만:3,말:3,"면 ":3,무:3,보:3,사:3,생각:3,서:3,선생님:3,세:3,수:3,스:3,시:3,신:3,아:3,안:3,않:3,야:3,어:3,없:3,었:3,에:3,여:3,오늘:3,"와 ":3,"왜 ":3,요:3,우:3,으:3,은:3,을:3,의:3,이:3,인:3,일:3,있:3,자:3,"절대 ":3,제:3,"좀 ":3,좋:3,주:3,지:3,"처럼 ":3,컴퓨터:3,"테 ":3,텔레비전:3,톰:3,프랑:3,하:3,한:3,"할 ":3,"함께 ":3,"항상 ":3,해:3,했:3,"히 ":3,"𝑥":9,"- ":9,";可俗話":2,"�":9}};var X=/([,,、。!¿?!?":;()「」{}„“«»”"“<>⋯《》*]|[.[\]\\])+/,Z=/[ ]+/;function W(e){return e.split(X)}function Y(e){return e.split(Z)}function y(e,n,o=!0){let t=[],a=o?" ".repeat(n-1)+e+" ".repeat(n-1):e;for(let s=0;s1)&&r.push(a[s+i]);let u=r.join("");u.trim().length>0&&u.length===n&&t.push(u)}return t}function x(e,n,o,t){for(let a of L){let s=y(e,a);for(let r of s){if(!o.has(r))continue;let A=F(n.uniques[r]);if(!(t.only.length>0&&!t.only.includes(A)))return t.verbose&&console.log(`[Pass 1] detectUniqueGrams ${a}-grams - match '${r}' to ${A}`),A}}return""}function q(e,n,o){let t=new Map,a=L.map(i=>y(e,i)).flat();o.verbose&&console.log("[Pass 2] DetectPotentialGrams",e,a);let s=new Set([...H.values()].filter(i=>o.only.length>0?o.only.includes(i)||o.only.includes(F(i)):!0));s.forEach(i=>t.set(i,0));for(let i of a){let I=j(i),l=n.multiples[I];if(!l)continue;let G=new Set(Object.keys(l)),m=[];for(let B of s)G.has(B)&&(t.set(B,(t.get(B)||0)+l[B]*I.length/4),m.push(`${B} = ${l[B]/1024*100}%`));o.verbose&&m.length>0&&console.log(`Gram '${I}'`,m)}let r=[...t.entries()];r.sort((i,I)=>I[1]-i[1]);let A=Math.max(...r.map(i=>i[1]))||1,u=r.slice(0,8).map(i=>({lang:F(i[0]),accuracy:1-d((A-i[1])/A),score:d(i[1])}));return o.verbose&&console.log("Result",e,u),u}function p(e,n,o,t){let a=W(e);a=a.map(i=>M(i)).filter(i=>!!i),a.sort((i,I)=>I.length-i.length),a=a.slice(0,7),n.verbose&&console.log("Analize chunks",a);let s=0,r={};for(let i of a){let I=x(i,o,t,n);if(I){r[I]=(r[I]||0)+1*i.length,s+=i.length;continue}let l=Y(i);for(let G of l)q(G,o,n).forEach(B=>{r[B.lang]=(r[B.lang]||0)+B.accuracy}),s+=G.length}let A=Object.entries(r).filter(i=>i[1]>0);A.sort((i,I)=>I[1]-i[1]);let u=A.map(i=>({lang:i[0],accuracy:i[1]/s}));return n.verbose&&console.log("Merge Results",u),u}var E=f,_={uniques:Object.fromEntries(Object.entries(E.uniques).map(e=>[e[0],J[parseInt(e[1].toString(),36)]])),multiples:Object.fromEntries(Object.entries(E.multiples).map(e=>{let n=Object.fromEntries(e[1].match(/(.{1,3})/g)?.map(o=>{let t=o.slice(0,1),a=o.slice(1);return[J[parseInt(t,36)],parseInt(a,36)]})||[]);return[e[0],n]}))},$=new Set(Object.keys(f.uniques));function C0(e,n){let o=e0(e,n);return o.length>0?o[0].lang:""}function e0(e,n){let o=k(n);return b(e)?p(e,o,_,$):[]} - ;// CONCATENATED MODULE: ./src/utils/getYTVideoData.js +async function detect(cleanText) { + const response = await fetch('https://rust-server-531j.onrender.com/detect', { + method: 'POST', + body: cleanText + }); + return await response.text(); +} - -// Get the language code from the response or the text -function getLanguage(player, response, title, description, author) { +async function getLanguage(player, response, title, description, author) { if (!window.location.hostname.includes("m.youtube.com")) { - // ! Experimental ! get lang from selected audio track if availabled const audioTracks = player.getAudioTrack(); - const trackInfo = audioTracks?.getLanguageInfo(); // get selected track info (id === "und" if tracks are not available) + const trackInfo = audioTracks?.getLanguageInfo(); if (trackInfo?.id !== "und") { return trackInfo.id.split(".")[0]; } } - // TODO: If the audio tracks will work fine, transfer the receipt of captions to the audioTracks variable - // Check if there is an automatic caption track in the response const captionTracks = response?.captions?.playerCaptionsTracklistRenderer?.captionTracks; if (captionTracks?.length) { @@ -1098,18 +1098,16 @@ function getLanguage(player, response, title, description, author) { return autoCaption.languageCode; } } - // If there is no caption track, use detect to get the language code from the text const text = [title, description, author].join(" "); - // Remove anything that is not a letter or a space in any language const cleanText = text .replace(/https?:\/\/\S+/g, "") .replace(/[^\p{L}\s]/gu, "") + .trim() .slice(0, 250); - return C0(cleanText); + return await detect(cleanText); } -// Get the video data from the player -function getYTVideoData() { +async function getYTVideoData() { const player = document.querySelector("#movie_player"); const data = player.getVideoData(); const response = player.getPlayerResponse(); @@ -1121,7 +1119,7 @@ function getYTVideoData() { title, description, author, - detectedLanguage: getLanguage(player, response, title, description, author), + detectedLanguage: await getLanguage(player, response, title, description, author), }; console.log("VOT Detected language: ", videoData.detectedLanguage); return videoData; @@ -1156,6 +1154,7 @@ const siteTranslates = { rutube: "https://rutube.ru/video/", "bilibili.com": "https://www.bilibili.com/video/", "mail.ru": "https://my.mail.ru/", + coub: "https://coub.com/view/" }; const translations = { ru: { @@ -1876,6 +1875,8 @@ const getVideoId = (service) => { return url.pathname; case "rutube": return url.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1]; + case "coub": + return url.pathname.match(/view\/([^/]+)/)?.[1]; case "bilibili.com": const bvid = url.searchParams.get("bvid"); if (bvid) { @@ -1890,6 +1891,13 @@ const getVideoId = (service) => { case "mail.ru": if (url.pathname.startsWith("/v/") || url.pathname.startsWith("/mail/")) { return url.pathname; + } else if (url.pathname.match(/video\/embed\/([^/]+)/)) { + const referer = document.querySelector('.b-video-controls__mymail-link'); + if (!referer) { + return false; + } + + return referer?.href.split('my.mail.ru')?.[1]; } default: return false; @@ -2396,6 +2404,8 @@ let translateFromLang = "en"; // default language of video let translateToLang = "ru"; // default language of audio response +let ytData = ""; + async function src_main() { utils_debug.log("Loading extension..."); utils_debug.log(`Selected menu language: ${lang}`); @@ -2574,7 +2584,7 @@ async function src_main() { utils_debug.log("video", video); - let videoData = getVideoData(); + let videoData = await getVideoData(); console.log("VOT Video Data: ", videoData); const container = @@ -2955,7 +2965,7 @@ async function src_main() { } } - function getVideoData() { + async function getVideoData() { const videoData = {}; videoData.duration = video?.duration || 0; @@ -2967,7 +2977,7 @@ async function src_main() { videoData.responseLanguage = translateToLang; if (window.location.hostname.includes("youtube.com")) { - let ytData = getYTVideoData(); + ytData = await getYTVideoData(); ytData = setDetectedLangauge(ytData, ytData.detectedLanguage); videoData.detectedLanguage = ytData.detectedLanguage; videoData.responseLanguage = ytData.responseLanguage; @@ -3020,26 +3030,14 @@ async function src_main() { } return; } - if (mode === "pause") { - utils_debug.log("lipsync mode is pause"); - audio.pause(); - } - if (mode === "stop") { - utils_debug.log("lipsync mode is stop"); - audio.pause(); - } - if (mode === "waiting") { - utils_debug.log("lipsync mode is waiting"); + if (mode === "pause" || "stop" || 0|| 0) { + utils_debug.log(`lipsync mode is ${mode}`); audio.pause(); } if (mode === "playing") { utils_debug.log("lipsync mode is playing"); audio.play(); } - if (mode === "abort") { - utils_debug.log("lipsync mode is abort"); - audio.pause(); - } }; function addVideoSlider() { @@ -3186,9 +3184,8 @@ async function src_main() { tempVolume = translationValue; } - function videoValidator() { + async function videoValidator() { if (window.location.hostname.includes("youtube.com")) { - let ytData = getYTVideoData(); ytData = setDetectedLangauge(ytData, ytData.detectedLanguage); utils_debug.log("VideoValidator videoData: ", videoData); if (dontTranslateYourLang === 1 && ytData.detectedLanguage === lang) { @@ -3210,16 +3207,17 @@ async function src_main() { return true; } - const translateExecutor = (VIDEO_ID) => { + const translateExecutor = async (VIDEO_ID) => { utils_debug.log("Run videoValidator"); - videoValidator(); + await videoValidator(); utils_debug.log("Run translateFunc"); - translateFunc( + await translateFunc( VIDEO_ID, videoData.detectedLanguage, videoData.responseLanguage ); }; + // Define a function to handle common events function handleVideoEvent(event) { @@ -3452,14 +3450,14 @@ async function src_main() { throw translations[lang].VOTNoVideoIDFound; } - translateExecutor(VIDEO_ID); + await translateExecutor(VIDEO_ID); } catch (err) { transformBtn("error", String(err).substring(4, err.length)); console.error(err); } }); - video.addEventListener("progress", (event) => { + video.addEventListener("progress", async (event) => { event.stopPropagation(); if (!(firstPlay && dbAutoTranslate === 1)) { @@ -3472,7 +3470,7 @@ async function src_main() { } try { - translateExecutor(VIDEO_ID); + await translateExecutor(VIDEO_ID); firstPlay = false; } catch (err) { transformBtn("error", String(err).substring(4, err.length)); @@ -3706,6 +3704,13 @@ async function src_main() { "9gag", null ); + } else if (window.location.hostname.includes("coub.com")) { + await sleep(1000); + await translateProccessor( + document.querySelector('.viewer__player'), + "coub", + null + ); } else if (window.location.hostname.includes("rutube.ru")) { const elementSelector = window.location.pathname.includes("/play/embed") ? "#app > div > div" @@ -3780,7 +3785,6 @@ async function src_main() { src_main().catch((e) => { console.error(e); }); - })(); /******/ })() diff --git a/src/config/constants.js b/src/config/constants.js index 8929b320..3cc50e31 100644 --- a/src/config/constants.js +++ b/src/config/constants.js @@ -22,7 +22,7 @@ const siteTranslates = { rutube: "https://rutube.ru/video/", "bilibili.com": "https://www.bilibili.com/video/", "mail.ru": "https://my.mail.ru/", - coub: "https://coub.com/view/" + coub: "https://coub.com/view/", }; const translations = { ru: { diff --git a/src/index.js b/src/index.js index 89b23c62..d8eb26fd 100644 --- a/src/index.js +++ b/src/index.js @@ -33,6 +33,8 @@ let translateFromLang = "en"; // default language of video let translateToLang = "ru"; // default language of audio response +let ytData = ""; + async function main() { debug.log("Loading extension..."); debug.log(`Selected menu language: ${lang}`); @@ -218,7 +220,7 @@ async function main() { debug.log("video", video); - let videoData = getVideoData(); + let videoData = await getVideoData(); console.log("VOT Video Data: ", videoData); const container = @@ -618,7 +620,7 @@ async function main() { } } - function getVideoData() { + async function getVideoData() { const videoData = {}; videoData.duration = video?.duration || 0; @@ -630,7 +632,7 @@ async function main() { videoData.responseLanguage = translateToLang; if (window.location.hostname.includes("youtube.com")) { - let ytData = getYTVideoData(); + ytData = await getYTVideoData(); ytData = setDetectedLangauge(ytData, ytData.detectedLanguage); videoData.detectedLanguage = ytData.detectedLanguage; videoData.responseLanguage = ytData.responseLanguage; @@ -683,26 +685,14 @@ async function main() { } return; } - if (mode === "pause") { - debug.log("lipsync mode is pause"); - audio.pause(); - } - if (mode === "stop") { - debug.log("lipsync mode is stop"); - audio.pause(); - } - if (mode === "waiting") { - debug.log("lipsync mode is waiting"); + if (mode === "pause" || "stop" || "waiting" || "abort") { + debug.log(`lipsync mode is ${mode}`); audio.pause(); } if (mode === "playing") { debug.log("lipsync mode is playing"); audio.play(); } - if (mode === "abort") { - debug.log("lipsync mode is abort"); - audio.pause(); - } }; function addVideoSlider() { @@ -849,9 +839,8 @@ async function main() { tempVolume = translationValue; } - function videoValidator() { + async function videoValidator() { if (window.location.hostname.includes("youtube.com")) { - let ytData = getYTVideoData(); ytData = setDetectedLangauge(ytData, ytData.detectedLanguage); debug.log("VideoValidator videoData: ", videoData); if (dontTranslateYourLang === 1 && ytData.detectedLanguage === lang) { @@ -873,11 +862,11 @@ async function main() { return true; } - const translateExecutor = (VIDEO_ID) => { + const translateExecutor = async (VIDEO_ID) => { debug.log("Run videoValidator"); - videoValidator(); + await videoValidator(); debug.log("Run translateFunc"); - translateFunc( + await translateFunc( VIDEO_ID, videoData.detectedLanguage, videoData.responseLanguage @@ -1125,14 +1114,14 @@ async function main() { throw translations[lang].VOTNoVideoIDFound; } - translateExecutor(VIDEO_ID); + await translateExecutor(VIDEO_ID); } catch (err) { transformBtn("error", String(err).substring(4, err.length)); console.error(err); } }); - video.addEventListener("progress", (event) => { + video.addEventListener("progress", async (event) => { event.stopPropagation(); if (!(firstPlay && dbAutoTranslate === 1)) { @@ -1145,7 +1134,7 @@ async function main() { } try { - translateExecutor(VIDEO_ID); + await translateExecutor(VIDEO_ID); firstPlay = false; } catch (err) { transformBtn("error", String(err).substring(4, err.length)); @@ -1382,7 +1371,7 @@ async function main() { } else if (window.location.hostname.includes("coub.com")) { await sleep(1000); await translateProccessor( - document.querySelector('.viewer__player'), + document.querySelector(".viewer__player"), "coub", null ); diff --git a/src/indexedDB.js b/src/indexedDB.js index 88d044bc..778e7ea3 100644 --- a/src/indexedDB.js +++ b/src/indexedDB.js @@ -14,8 +14,8 @@ const settingsDefault = { }; // default settings for db v1 const valuesV2 = { - audioProxy: 0 -} + audioProxy: 0, +}; function openDB(name) { return indexedDB.open(name, dbVersion); @@ -23,7 +23,12 @@ function openDB(name) { async function initDB() { return new Promise((resolve, reject) => { - function updateVersionProccessor(transaction, db, indexes, previousIndexes = {}) { + function updateVersionProccessor( + transaction, + db, + indexes, + previousIndexes = {} + ) { // openRequest is transaction object // indexes is object of strings with default values (used for createIndex) ex. {"name": 0} // previousIndexes is indexes for previous version @@ -49,7 +54,8 @@ async function initDB() { }; request.onsuccess = () => { - const data = request.result || Object.assign(settingsDefault, previousIndexes); // use data from db or reset all data + const data = + request.result || Object.assign(settingsDefault, previousIndexes); // use data from db or reset all data for (const key in indexes) { data[key] = indexes[key]; } @@ -100,7 +106,9 @@ async function initDB() { }); // add indexes for 1 version (without key index) - for (const key of Object.keys(settingsDefault).filter(k => k !== "key")) { + for (const key of Object.keys(settingsDefault).filter( + (k) => k !== "key" + )) { objectStore.createIndex(key, key, { unique: false }); } @@ -338,4 +346,4 @@ function deleteDB() { indexedDB.deleteDatabase("VOT"); } -export { initDB, readDB, updateDB, deleteDB }; \ No newline at end of file +export { initDB, readDB, updateDB, deleteDB }; diff --git a/src/utils/getYTVideoData.js b/src/utils/getYTVideoData.js index 778d064d..0bdb227a 100644 --- a/src/utils/getYTVideoData.js +++ b/src/utils/getYTVideoData.js @@ -1,18 +1,20 @@ -import { detect } from "tinyld/light"; +async function detect(cleanText) { + const response = await fetch("https://rust-server-531j.onrender.com/detect", { + method: "POST", + body: cleanText, + }); + return await response.text(); +} -// Get the language code from the response or the text -function getLanguage(player, response, title, description, author) { +async function getLanguage(player, response, title, description, author) { if (!window.location.hostname.includes("m.youtube.com")) { - // ! Experimental ! get lang from selected audio track if availabled const audioTracks = player.getAudioTrack(); - const trackInfo = audioTracks?.getLanguageInfo(); // get selected track info (id === "und" if tracks are not available) + const trackInfo = audioTracks?.getLanguageInfo(); if (trackInfo?.id !== "und") { return trackInfo.id.split(".")[0]; } } - // TODO: If the audio tracks will work fine, transfer the receipt of captions to the audioTracks variable - // Check if there is an automatic caption track in the response const captionTracks = response?.captions?.playerCaptionsTracklistRenderer?.captionTracks; if (captionTracks?.length) { @@ -21,18 +23,16 @@ function getLanguage(player, response, title, description, author) { return autoCaption.languageCode; } } - // If there is no caption track, use detect to get the language code from the text const text = [title, description, author].join(" "); - // Remove anything that is not a letter or a space in any language const cleanText = text .replace(/https?:\/\/\S+/g, "") .replace(/[^\p{L}\s]/gu, "") + .trim() .slice(0, 250); - return detect(cleanText); + return await detect(cleanText); } -// Get the video data from the player -function getYTVideoData() { +async function getYTVideoData() { const player = document.querySelector("#movie_player"); const data = player.getVideoData(); const response = player.getPlayerResponse(); @@ -44,7 +44,13 @@ function getYTVideoData() { title, description, author, - detectedLanguage: getLanguage(player, response, title, description, author), + detectedLanguage: await getLanguage( + player, + response, + title, + description, + author + ), }; console.log("VOT Detected language: ", videoData.detectedLanguage); return videoData; diff --git a/src/utils/utils.js b/src/utils/utils.js index ebee1006..8a0d7d6f 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -133,12 +133,14 @@ const getVideoId = (service) => { if (url.pathname.startsWith("/v/") || url.pathname.startsWith("/mail/")) { return url.pathname; } else if (url.pathname.match(/video\/embed\/([^/]+)/)) { - const referer = document.querySelector('.b-video-controls__mymail-link'); + const referer = document.querySelector( + ".b-video-controls__mymail-link" + ); if (!referer) { return false; } - return referer?.href.split('my.mail.ru')?.[1]; + return referer?.href.split("my.mail.ru")?.[1]; } default: return false; From 0b0346ca476888470b89297779bfee8895b471c3 Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Sat, 22 Jul 2023 07:46:35 +0400 Subject: [PATCH 02/48] Add files via upload --- src/utils/getYTVideoData.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/utils/getYTVideoData.js b/src/utils/getYTVideoData.js index 0bdb227a..e41d4009 100644 --- a/src/utils/getYTVideoData.js +++ b/src/utils/getYTVideoData.js @@ -6,15 +6,19 @@ async function detect(cleanText) { return await response.text(); } +// Get the language code from the response or the text async function getLanguage(player, response, title, description, author) { if (!window.location.hostname.includes("m.youtube.com")) { + // ! Experimental ! get lang from selected audio track if availabled const audioTracks = player.getAudioTrack(); - const trackInfo = audioTracks?.getLanguageInfo(); + const trackInfo = audioTracks?.getLanguageInfo(); // get selected track info (id === "und" if tracks are not available) if (trackInfo?.id !== "und") { return trackInfo.id.split(".")[0]; } } + // TODO: If the audio tracks will work fine, transfer the receipt of captions to the audioTracks variable + // Check if there is an automatic caption track in the response const captionTracks = response?.captions?.playerCaptionsTracklistRenderer?.captionTracks; if (captionTracks?.length) { @@ -23,7 +27,9 @@ async function getLanguage(player, response, title, description, author) { return autoCaption.languageCode; } } + // If there is no caption track, use detect to get the language code from the text const text = [title, description, author].join(" "); + // Remove anything that is not a letter or a space in any language const cleanText = text .replace(/https?:\/\/\S+/g, "") .replace(/[^\p{L}\s]/gu, "") @@ -32,6 +38,7 @@ async function getLanguage(player, response, title, description, author) { return await detect(cleanText); } +// Get the video data from the player async function getYTVideoData() { const player = document.querySelector("#movie_player"); const data = player.getVideoData(); From ddf0cf35b4b1b6a1255c72d0ee459c6a22f70391 Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Sat, 22 Jul 2023 08:45:55 +0400 Subject: [PATCH 03/48] min fix --- dist/vot-cloudflare.user.js | 56 ++++++++++++++++++++++++++----------- dist/vot.user.js | 56 ++++++++++++++++++++++++++----------- 2 files changed, 80 insertions(+), 32 deletions(-) diff --git a/dist/vot-cloudflare.user.js b/dist/vot-cloudflare.user.js index 6b36b78a..bdd0e30f 100644 --- a/dist/vot-cloudflare.user.js +++ b/dist/vot-cloudflare.user.js @@ -777,7 +777,7 @@ const siteTranslates = { rutube: "https://rutube.ru/video/", "bilibili.com": "https://www.bilibili.com/video/", "mail.ru": "https://my.mail.ru/", - coub: "https://coub.com/view/" + coub: "https://coub.com/view/", }; const translations = { ru: { @@ -1560,22 +1560,26 @@ var update = injectStylesIntoStyleTag_default()(main/* default */.Z, options); ;// CONCATENATED MODULE: ./src/utils/getYTVideoData.js async function detect(cleanText) { - const response = await fetch('https://rust-server-531j.onrender.com/detect', { - method: 'POST', - body: cleanText + const response = await fetch("https://rust-server-531j.onrender.com/detect", { + method: "POST", + body: cleanText, }); return await response.text(); } +// Get the language code from the response or the text async function getLanguage(player, response, title, description, author) { if (!window.location.hostname.includes("m.youtube.com")) { + // ! Experimental ! get lang from selected audio track if availabled const audioTracks = player.getAudioTrack(); - const trackInfo = audioTracks?.getLanguageInfo(); + const trackInfo = audioTracks?.getLanguageInfo(); // get selected track info (id === "und" if tracks are not available) if (trackInfo?.id !== "und") { return trackInfo.id.split(".")[0]; } } + // TODO: If the audio tracks will work fine, transfer the receipt of captions to the audioTracks variable + // Check if there is an automatic caption track in the response const captionTracks = response?.captions?.playerCaptionsTracklistRenderer?.captionTracks; if (captionTracks?.length) { @@ -1584,7 +1588,9 @@ async function getLanguage(player, response, title, description, author) { return autoCaption.languageCode; } } + // If there is no caption track, use detect to get the language code from the text const text = [title, description, author].join(" "); + // Remove anything that is not a letter or a space in any language const cleanText = text .replace(/https?:\/\/\S+/g, "") .replace(/[^\p{L}\s]/gu, "") @@ -1593,6 +1599,7 @@ async function getLanguage(player, response, title, description, author) { return await detect(cleanText); } +// Get the video data from the player async function getYTVideoData() { const player = document.querySelector("#movie_player"); const data = player.getVideoData(); @@ -1605,7 +1612,13 @@ async function getYTVideoData() { title, description, author, - detectedLanguage: await getLanguage(player, response, title, description, author), + detectedLanguage: await getLanguage( + player, + response, + title, + description, + author + ), }; console.log("VOT Detected language: ", videoData.detectedLanguage); return videoData; @@ -1945,12 +1958,14 @@ const getVideoId = (service) => { if (url.pathname.startsWith("/v/") || url.pathname.startsWith("/mail/")) { return url.pathname; } else if (url.pathname.match(/video\/embed\/([^/]+)/)) { - const referer = document.querySelector('.b-video-controls__mymail-link'); + const referer = document.querySelector( + ".b-video-controls__mymail-link" + ); if (!referer) { return false; } - return referer?.href.split('my.mail.ru')?.[1]; + return referer?.href.split("my.mail.ru")?.[1]; } default: return false; @@ -2050,8 +2065,8 @@ const settingsDefault = { }; // default settings for db v1 const valuesV2 = { - audioProxy: 0 -} + audioProxy: 0, +}; function openDB(name) { return indexedDB.open(name, dbVersion); @@ -2059,7 +2074,12 @@ function openDB(name) { async function initDB() { return new Promise((resolve, reject) => { - function updateVersionProccessor(transaction, db, indexes, previousIndexes = {}) { + function updateVersionProccessor( + transaction, + db, + indexes, + previousIndexes = {} + ) { // openRequest is transaction object // indexes is object of strings with default values (used for createIndex) ex. {"name": 0} // previousIndexes is indexes for previous version @@ -2085,7 +2105,8 @@ async function initDB() { }; request.onsuccess = () => { - const data = request.result || Object.assign(settingsDefault, previousIndexes); // use data from db or reset all data + const data = + request.result || Object.assign(settingsDefault, previousIndexes); // use data from db or reset all data for (const key in indexes) { data[key] = indexes[key]; } @@ -2136,7 +2157,9 @@ async function initDB() { }); // add indexes for 1 version (without key index) - for (const key of Object.keys(settingsDefault).filter(k => k !== "key")) { + for (const key of Object.keys(settingsDefault).filter( + (k) => k !== "key" + )) { objectStore.createIndex(key, key, { unique: false }); } @@ -2375,6 +2398,7 @@ function deleteDB() { } + ;// CONCATENATED MODULE: ./src/utils/volume.js // element - audio / video element function syncVolume(element, sliderVolume, otherSliderVolume, tempVolume) { @@ -3101,7 +3125,7 @@ async function src_main() { } return; } - if (mode === "pause" || "stop" || 0|| 0) { + if (mode === "pause" || "stop" || 0 || 0) { debug/* default */.Z.log(`lipsync mode is ${mode}`); audio.pause(); } @@ -3288,7 +3312,6 @@ async function src_main() { videoData.responseLanguage ); }; - // Define a function to handle common events function handleVideoEvent(event) { @@ -3788,7 +3811,7 @@ async function src_main() { } else if (window.location.hostname.includes("coub.com")) { await sleep(1000); await translateProccessor( - document.querySelector('.viewer__player'), + document.querySelector(".viewer__player"), "coub", null ); @@ -3866,6 +3889,7 @@ async function src_main() { src_main().catch((e) => { console.error(e); }); + })(); /******/ })() diff --git a/dist/vot.user.js b/dist/vot.user.js index 2c52f315..dd7ecb3f 100644 --- a/dist/vot.user.js +++ b/dist/vot.user.js @@ -1074,22 +1074,26 @@ var update = injectStylesIntoStyleTag_default()(main/* default */.Z, options); ;// CONCATENATED MODULE: ./src/utils/getYTVideoData.js async function detect(cleanText) { - const response = await fetch('https://rust-server-531j.onrender.com/detect', { - method: 'POST', - body: cleanText + const response = await fetch("https://rust-server-531j.onrender.com/detect", { + method: "POST", + body: cleanText, }); return await response.text(); } +// Get the language code from the response or the text async function getLanguage(player, response, title, description, author) { if (!window.location.hostname.includes("m.youtube.com")) { + // ! Experimental ! get lang from selected audio track if availabled const audioTracks = player.getAudioTrack(); - const trackInfo = audioTracks?.getLanguageInfo(); + const trackInfo = audioTracks?.getLanguageInfo(); // get selected track info (id === "und" if tracks are not available) if (trackInfo?.id !== "und") { return trackInfo.id.split(".")[0]; } } + // TODO: If the audio tracks will work fine, transfer the receipt of captions to the audioTracks variable + // Check if there is an automatic caption track in the response const captionTracks = response?.captions?.playerCaptionsTracklistRenderer?.captionTracks; if (captionTracks?.length) { @@ -1098,7 +1102,9 @@ async function getLanguage(player, response, title, description, author) { return autoCaption.languageCode; } } + // If there is no caption track, use detect to get the language code from the text const text = [title, description, author].join(" "); + // Remove anything that is not a letter or a space in any language const cleanText = text .replace(/https?:\/\/\S+/g, "") .replace(/[^\p{L}\s]/gu, "") @@ -1107,6 +1113,7 @@ async function getLanguage(player, response, title, description, author) { return await detect(cleanText); } +// Get the video data from the player async function getYTVideoData() { const player = document.querySelector("#movie_player"); const data = player.getVideoData(); @@ -1119,7 +1126,13 @@ async function getYTVideoData() { title, description, author, - detectedLanguage: await getLanguage(player, response, title, description, author), + detectedLanguage: await getLanguage( + player, + response, + title, + description, + author + ), }; console.log("VOT Detected language: ", videoData.detectedLanguage); return videoData; @@ -1154,7 +1167,7 @@ const siteTranslates = { rutube: "https://rutube.ru/video/", "bilibili.com": "https://www.bilibili.com/video/", "mail.ru": "https://my.mail.ru/", - coub: "https://coub.com/view/" + coub: "https://coub.com/view/", }; const translations = { ru: { @@ -1892,12 +1905,14 @@ const getVideoId = (service) => { if (url.pathname.startsWith("/v/") || url.pathname.startsWith("/mail/")) { return url.pathname; } else if (url.pathname.match(/video\/embed\/([^/]+)/)) { - const referer = document.querySelector('.b-video-controls__mymail-link'); + const referer = document.querySelector( + ".b-video-controls__mymail-link" + ); if (!referer) { return false; } - return referer?.href.split('my.mail.ru')?.[1]; + return referer?.href.split("my.mail.ru")?.[1]; } default: return false; @@ -1997,8 +2012,8 @@ const settingsDefault = { }; // default settings for db v1 const valuesV2 = { - audioProxy: 0 -} + audioProxy: 0, +}; function openDB(name) { return indexedDB.open(name, dbVersion); @@ -2006,7 +2021,12 @@ function openDB(name) { async function initDB() { return new Promise((resolve, reject) => { - function updateVersionProccessor(transaction, db, indexes, previousIndexes = {}) { + function updateVersionProccessor( + transaction, + db, + indexes, + previousIndexes = {} + ) { // openRequest is transaction object // indexes is object of strings with default values (used for createIndex) ex. {"name": 0} // previousIndexes is indexes for previous version @@ -2032,7 +2052,8 @@ async function initDB() { }; request.onsuccess = () => { - const data = request.result || Object.assign(settingsDefault, previousIndexes); // use data from db or reset all data + const data = + request.result || Object.assign(settingsDefault, previousIndexes); // use data from db or reset all data for (const key in indexes) { data[key] = indexes[key]; } @@ -2083,7 +2104,9 @@ async function initDB() { }); // add indexes for 1 version (without key index) - for (const key of Object.keys(settingsDefault).filter(k => k !== "key")) { + for (const key of Object.keys(settingsDefault).filter( + (k) => k !== "key" + )) { objectStore.createIndex(key, key, { unique: false }); } @@ -2322,6 +2345,7 @@ function deleteDB() { } + ;// CONCATENATED MODULE: ./src/utils/volume.js // element - audio / video element function syncVolume(element, sliderVolume, otherSliderVolume, tempVolume) { @@ -3030,7 +3054,7 @@ async function src_main() { } return; } - if (mode === "pause" || "stop" || 0|| 0) { + if (mode === "pause" || "stop" || 0 || 0) { utils_debug.log(`lipsync mode is ${mode}`); audio.pause(); } @@ -3217,7 +3241,6 @@ async function src_main() { videoData.responseLanguage ); }; - // Define a function to handle common events function handleVideoEvent(event) { @@ -3707,7 +3730,7 @@ async function src_main() { } else if (window.location.hostname.includes("coub.com")) { await sleep(1000); await translateProccessor( - document.querySelector('.viewer__player'), + document.querySelector(".viewer__player"), "coub", null ); @@ -3785,6 +3808,7 @@ async function src_main() { src_main().catch((e) => { console.error(e); }); + })(); /******/ })() From ed6b9672effa44de77b44f015f8a4d3782483fbe Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Sat, 22 Jul 2023 08:56:28 +0400 Subject: [PATCH 04/48] async fix --- src/dist/vot-cloudflare-min.user.js | 87 + src/dist/vot-cloudflare.user.js | 3896 +++++++++++++++++++++++++++ src/dist/vot-min.user.js | 86 + src/dist/vot.user.js | 3815 ++++++++++++++++++++++++++ src/src/config/alternativeUrls.js | 52 + src/src/config/config-cloudflare.js | 5 + src/src/config/config.js | 8 + src/src/config/constants.js | 400 +++ src/src/config/regexes.js | 7 + src/src/config/selectors.js | 17 + src/src/getUUID.js | 11 + src/src/headers.json | 75 + src/src/index.js | 1451 ++++++++++ src/src/indexedDB.js | 349 +++ src/src/locales/de/headers.json | 4 + src/src/locales/es/headers.json | 4 + src/src/locales/fr/headers.json | 4 + src/src/locales/it/headers.json | 4 + src/src/locales/ru/headers.json | 4 + src/src/locales/zh/headers.json | 4 + src/src/menu.js | 196 ++ src/src/rvt-cloudflare.js | 87 + src/src/rvt.js | 78 + src/src/styles/main.css | 247 ++ src/src/utils/debug.js | 33 + src/src/utils/getYTVideoData.js | 66 + src/src/utils/regex.js | 11 + src/src/utils/utils.js | 168 ++ src/src/utils/volume.js | 29 + src/src/yandexRequests.js | 97 + 30 files changed, 11295 insertions(+) create mode 100644 src/dist/vot-cloudflare-min.user.js create mode 100644 src/dist/vot-cloudflare.user.js create mode 100644 src/dist/vot-min.user.js create mode 100644 src/dist/vot.user.js create mode 100644 src/src/config/alternativeUrls.js create mode 100644 src/src/config/config-cloudflare.js create mode 100644 src/src/config/config.js create mode 100644 src/src/config/constants.js create mode 100644 src/src/config/regexes.js create mode 100644 src/src/config/selectors.js create mode 100644 src/src/getUUID.js create mode 100644 src/src/headers.json create mode 100644 src/src/index.js create mode 100644 src/src/indexedDB.js create mode 100644 src/src/locales/de/headers.json create mode 100644 src/src/locales/es/headers.json create mode 100644 src/src/locales/fr/headers.json create mode 100644 src/src/locales/it/headers.json create mode 100644 src/src/locales/ru/headers.json create mode 100644 src/src/locales/zh/headers.json create mode 100644 src/src/menu.js create mode 100644 src/src/rvt-cloudflare.js create mode 100644 src/src/rvt.js create mode 100644 src/src/styles/main.css create mode 100644 src/src/utils/debug.js create mode 100644 src/src/utils/getYTVideoData.js create mode 100644 src/src/utils/regex.js create mode 100644 src/src/utils/utils.js create mode 100644 src/src/utils/volume.js create mode 100644 src/src/yandexRequests.js diff --git a/src/dist/vot-cloudflare-min.user.js b/src/dist/vot-cloudflare-min.user.js new file mode 100644 index 00000000..93020226 --- /dev/null +++ b/src/dist/vot-cloudflare-min.user.js @@ -0,0 +1,87 @@ +// ==UserScript== +// @name [VOT Cloudflare] - Voice Over Translation +// @name:de [VOT Cloudflare] - Voice-Over-Video-Übersetzung +// @name:es [VOT Cloudflare] - Traducción de vídeo en off +// @name:fr [VOT Cloudflare] - Traduction vidéo voix-off +// @name:it [VOT Cloudflare] - Traduzione Video fuori campo +// @name:ru [VOT Cloudflare] - Закадровый перевод видео +// @name:zh [VOT Cloudflare] - 画外音视频翻译 +// @description A small extension that adds a Yandex Browser video translation to other browsers +// @description:de Eine kleine Erweiterung, die eine Voice-over-Übersetzung von Videos aus dem Yandex-Browser zu anderen Browsern hinzufügt +// @description:es Una pequeña extensión que agrega una traducción de voz en off de un video de Yandex Browser a otros navegadores +// @description:fr Une petite extension qui ajoute la traduction vocale de la vidéo du Navigateur Yandex à d'autres navigateurs +// @description:it Una piccola estensione che aggiunge la traduzione vocale del video dal browser Yandex ad altri browser +// @description:ru Небольшое расширение, которое добавляет закадровый перевод видео из Яндекс Браузера в другие браузеры +// @description:zh 一个小扩展,它增加了视频从Yandex浏览器到其他浏览器的画外音翻译 +// @version 1.3.4-testing +// @author sodapng, mynovelhost, Toil, SashaXser +// @supportURL https://github.com/ilyhalight/voice-over-translation/issues +// @match *://*.youtube.com/* +// @match *://*.youtube-nocookie.com/* +// @match *://*.twitch.tv/* +// @match *://*.xvideos.com/* +// @match *://*.pornhub.com/* +// @match *://*.vk.com/* +// @match *://*.vk.ru/* +// @match *://invidious.snopyta.org/* +// @match *://invidious.kavin.rocks/* +// @match *://vid.puffyan.us/* +// @match *://invidious.namazso.eu/* +// @match *://inv.riverside.rocks/* +// @match *://yt.artemislena.eu/* +// @match *://invidious.flokinet.to/* +// @match *://invidious.esmailelbob.xyz/* +// @match *://invidious.nerdvpn.de/* +// @match *://invidious.slipfox.xyz/* +// @match *://invidio.xamh.de/* +// @match *://invidious.dhusch.de/* +// @match *://*.piped.video/* +// @match *://piped.tokhmi.xyz/* +// @match *://piped.moomoo.me/* +// @match *://piped.syncpundit.io/* +// @match *://piped.mha.fi/* +// @match *://watch.whatever.social/* +// @match *://piped.garudalinux.org/* +// @match *://efy.piped.pages.dev/* +// @match *://watch.leptons.xyz/* +// @match *://piped.lunar.icu/* +// @match *://yt.dc09.ru/* +// @match *://piped.mint.lgbt/* +// @match *://*.il.ax/* +// @match *://piped.privacy.com.de/* +// @match *://piped.esmailelbob.xyz/* +// @match *://piped.projectsegfau.lt/* +// @match *://piped.in.projectsegfau.lt/* +// @match *://piped.us.projectsegfau.lt/* +// @match *://piped.privacydev.net/* +// @match *://piped.palveluntarjoaja.eu/* +// @match *://piped.smnz.de/* +// @match *://piped.adminforge.de/* +// @match *://piped.qdi.fi/* +// @match *://piped.hostux.net/* +// @match *://piped.chauvet.pro/* +// @match *://piped.jotoma.de/* +// @match *://piped.pfcd.me/* +// @match *://piped.frontendfriendly.xyz/* +// @match *://*.yewtu.be/* +// @match *://inv.vern.cc/* +// @match *://*.vimeo.com/* +// @match *://*.9gag.com/* +// @match *://*.twitter.com/* +// @match *://*.facebook.com/* +// @match *://*.rutube.ru/* +// @match *://*.bilibili.com/* +// @match *://my.mail.ru/* +// @connect api.browser.yandex.ru +// @downloadURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js +// @grant GM_xmlhttpRequest +// @grant GM_info +// @homepageURL https://github.com/ilyhalight/voice-over-translation/issues +// @icon https://translate.yandex.ru/icons/favicon.ico +// @inject-into page +// @namespace vot-cloudflare +// @require https://cdnjs.cloudflare.com/ajax/libs/protobufjs/7.2.3/protobuf.min.js +// @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js +// ==/UserScript== + +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const $={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},Z=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,$=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let Z=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",Z);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:Z.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:Z.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),Z=await Y(Z,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),Z=await W(Z,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}function U(e,t=b){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t)}async function Y(e,t){switch(t){case"en":e.detectedLanguage=t,e.responseLanguage=b;break;case"ru":e.detectedLanguage=t,e.responseLanguage=b,"ru"==b&&(e.responseLanguage="en");break;default:if(!Object.keys(v.tW).includes(t))return Y(e,"en");e.detectedLanguage=t}return U(e.detectedLanguage,e.responseLanguage),e}async function W(e,t){if("en"===t)e.responseLanguage=t,e.detectedLanguage="ru";else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return U(e.detectedLanguage,e.responseLanguage),e}function G(){o.pause(),p.removeEventListener(".translate",G,!1),o.src="",o.removeAttribute("src"),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)y.Z.log(`lipsync mode is ${e}`),o.pause(),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(ee=Y(ee,ee.detectedLanguage),y.Z.log("VideoValidator videoData: ",Z),1===z&&ee.detectedLanguage===b)throw $=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if(Z.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,Z.detectedLanguage,Z.responseLanguage)};function ne(e){y.Z.log(`video ${e.type}`),J(e.type)}function oe(){G(),K()}function ae(t,a,i){!function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(`${v.g$[u]}${t}`,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),$=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),X(),function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,n)))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!$||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),$=!1}catch(e){O("error",String(e).substring(4,e.length)),$=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),$.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(Z);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/src/dist/vot-cloudflare.user.js b/src/dist/vot-cloudflare.user.js new file mode 100644 index 00000000..8318a36d --- /dev/null +++ b/src/dist/vot-cloudflare.user.js @@ -0,0 +1,3896 @@ +// ==UserScript== +// @name [VOT Cloudflare] - Voice Over Translation +// @name:de [VOT Cloudflare] - Voice-Over-Video-Übersetzung +// @name:es [VOT Cloudflare] - Traducción de vídeo en off +// @name:fr [VOT Cloudflare] - Traduction vidéo voix-off +// @name:it [VOT Cloudflare] - Traduzione Video fuori campo +// @name:ru [VOT Cloudflare] - Закадровый перевод видео +// @name:zh [VOT Cloudflare] - 画外音视频翻译 +// @description A small extension that adds a Yandex Browser video translation to other browsers +// @description:de Eine kleine Erweiterung, die eine Voice-over-Übersetzung von Videos aus dem Yandex-Browser zu anderen Browsern hinzufügt +// @description:es Una pequeña extensión que agrega una traducción de voz en off de un video de Yandex Browser a otros navegadores +// @description:fr Une petite extension qui ajoute la traduction vocale de la vidéo du Navigateur Yandex à d'autres navigateurs +// @description:it Una piccola estensione che aggiunge la traduzione vocale del video dal browser Yandex ad altri browser +// @description:ru Небольшое расширение, которое добавляет закадровый перевод видео из Яндекс Браузера в другие браузеры +// @description:zh 一个小扩展,它增加了视频从Yandex浏览器到其他浏览器的画外音翻译 +// @version 1.3.4-testing +// @author sodapng, mynovelhost, Toil, SashaXser +// @supportURL https://github.com/ilyhalight/voice-over-translation/issues +// @match *://*.youtube.com/* +// @match *://*.youtube-nocookie.com/* +// @match *://*.twitch.tv/* +// @match *://*.xvideos.com/* +// @match *://*.pornhub.com/* +// @match *://*.vk.com/* +// @match *://*.vk.ru/* +// @match *://invidious.snopyta.org/* +// @match *://invidious.kavin.rocks/* +// @match *://vid.puffyan.us/* +// @match *://invidious.namazso.eu/* +// @match *://inv.riverside.rocks/* +// @match *://yt.artemislena.eu/* +// @match *://invidious.flokinet.to/* +// @match *://invidious.esmailelbob.xyz/* +// @match *://invidious.nerdvpn.de/* +// @match *://invidious.slipfox.xyz/* +// @match *://invidio.xamh.de/* +// @match *://invidious.dhusch.de/* +// @match *://*.piped.video/* +// @match *://piped.tokhmi.xyz/* +// @match *://piped.moomoo.me/* +// @match *://piped.syncpundit.io/* +// @match *://piped.mha.fi/* +// @match *://watch.whatever.social/* +// @match *://piped.garudalinux.org/* +// @match *://efy.piped.pages.dev/* +// @match *://watch.leptons.xyz/* +// @match *://piped.lunar.icu/* +// @match *://yt.dc09.ru/* +// @match *://piped.mint.lgbt/* +// @match *://*.il.ax/* +// @match *://piped.privacy.com.de/* +// @match *://piped.esmailelbob.xyz/* +// @match *://piped.projectsegfau.lt/* +// @match *://piped.in.projectsegfau.lt/* +// @match *://piped.us.projectsegfau.lt/* +// @match *://piped.privacydev.net/* +// @match *://piped.palveluntarjoaja.eu/* +// @match *://piped.smnz.de/* +// @match *://piped.adminforge.de/* +// @match *://piped.qdi.fi/* +// @match *://piped.hostux.net/* +// @match *://piped.chauvet.pro/* +// @match *://piped.jotoma.de/* +// @match *://piped.pfcd.me/* +// @match *://piped.frontendfriendly.xyz/* +// @match *://*.yewtu.be/* +// @match *://inv.vern.cc/* +// @match *://*.vimeo.com/* +// @match *://*.9gag.com/* +// @match *://*.twitter.com/* +// @match *://*.facebook.com/* +// @match *://*.rutube.ru/* +// @match *://*.bilibili.com/* +// @match *://my.mail.ru/* +// @connect api.browser.yandex.ru +// @downloadURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js +// @grant GM_xmlhttpRequest +// @grant GM_info +// @homepageURL https://github.com/ilyhalight/voice-over-translation/issues +// @icon https://translate.yandex.ru/icons/favicon.ico +// @inject-into page +// @namespace vot-cloudflare +// @require https://cdnjs.cloudflare.com/ajax/libs/protobufjs/7.2.3/protobuf.min.js +// @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js +// ==/UserScript== + +/******/ (() => { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ({ + +/***/ "./node_modules/css-loader/dist/cjs.js!./src/styles/main.css": +/***/ ((module, __webpack_exports__, __webpack_require__) => { + +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./node_modules/css-loader/dist/runtime/noSourceMaps.js"); +/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./node_modules/css-loader/dist/runtime/api.js"); +/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__); +// Imports + + +var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default())); +// Module +___CSS_LOADER_EXPORT___.push([module.id, `.translationBlock { + padding: 0.45rem !important; + width: max-content; + position: absolute; + background: #2e2f34; + border-radius: 0.5rem !important; + left: 50%; + top: 5rem; + transform: translate(-50%); + text-align: center; + opacity: 0; + transition: opacity 1s; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + z-index: 100; +} + +.translationBtn { + position: relative; + display: inline-block; + vertical-align: middle; + color: #fff; + padding-right: 0.25rem !important; + cursor: pointer; + font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif; +} + +.translationBlock:hover { + opacity: 1; +} + +.translationMenu { + display: inline-block; + vertical-align: middle; + border-left: 1px solid #424348; + max-height: 16px; + max-width: 24px; + cursor: pointer; +} + +.translationMenuIcon { + padding: 0 10px !important; + width: 24px; +} + +.translationIAlice { + display: inline-block; + vertical-align: middle; + max-height: 26px; + max-width: 50px; +} + +.translationIconAlice { + height: 24px !important; + width: 24px !important; +} + +.translationITranslate { + display: inline-block; + vertical-align: middle; + max-height: 20px; + max-width: 20px; +} + +.translationMenuContent { + position: absolute; + background: #2e2f34; + color: #fff; + display: none; + border-radius: 1rem !important; + left: 50%; + top: 10rem; + transform: translate(-50%); + text-align: left; + font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important; + + width: 300px; + /* height: 375px; */ + opacity: 0; + z-index: 100; + transition: opacity 0.5s ease; +} + +.VOTMenuSlider { + -webkit-appearance: none !important; + appearance: none !important; + width: 268px !important; + height: 8px !important; + outline: none !important; + margin-top: 0.5rem; + opacity: 0.7; + /* background: #3C3F4D !important; */ + background: rgb(253, 222, 85, 0.6) !important; + border: none !important; + border-radius: 2rem !important; + -webkit-transition: 0.2s !important; + transition: opacity 0.2s ease !important; +} + +.VOTMenuSlider:hover { + opacity: 1; +} + +.VOTMenuSlider::-webkit-slider-thumb { + -webkit-appearance: none !important; + appearance: none !important; + width: 10px !important; + height: 10px !important; + border-radius: 50% !important; + border: none !important; + background: #fff !important; + cursor: pointer !important; +} + +.VOTMenuSlider::-moz-range-thumb { + width: 10px !important; + height: 10px !important; + border-radius: 50% !important; + border: none !important; + background: #fff !important; + cursor: pointer !important; +} + +.VOTMenuSlider::-ms-thumb { + width: 10px !important; + height: 10px !important; + border-radius: 50% !important; + border: none !important; + background: #fff !important; + cursor: pointer !important; +} + +.VOTMenuSlider::-ms-fill-lower { + height: 8px !important; + border-radius: 2rem !important; + background: linear-gradient( + 90.1deg, + rgba(186, 153, 244, 0.85) -5.78%, + rgba(236, 138, 202, 0.7) 56.46%, + rgba(239, 168, 117, 0.6) 108.93% + ) !important; +} + +.VOTMenuSlider::-moz-range-progress { + height: 8px !important; + border-radius: 2rem !important; + background: linear-gradient( + 90.1deg, + rgba(186, 153, 244, 0.85) -5.78%, + rgba(236, 138, 202, 0.7) 56.46%, + rgba(239, 168, 117, 0.6) 108.93% + ) !important; +} + +.translationHeader { + padding-bottom: 0.5rem !important; +} + +.translationMainHeader { + margin: 16px !important; + color: #fff; + font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important; +} + +.translationMenuOptions { + display: flex; + flex-flow: column wrap; +} + +.translationMenuContainer { + /* width: 100%; */ + padding-left: 16px !important; + padding-top: 5px !important; + display: inline-block !important; +} + +.translationMenuContainer > input { + appearance: auto !important; + vertical-align: text-bottom; +} + +.translationMenuText { + color: #fff; + display: inline-flex; + width: 80%; +} + +.translationVolumeBox, +.translationVideoVolumeBox { + padding-top: 0.5rem !important; +} + +.translationDropDB { + border: none !important; + border-radius: 4px !important; + background: #5426ff !important; + color: #fff !important; + padding: 6px 16px !important; + margin-left: auto !important; + cursor: pointer !important; +} + +.translationDownload { + background: #5426ff !important; + color: #fff !important; + padding: 2px 10px !important; + border-radius: 4px !important; + cursor: pointer; + display: none; +} + +.translationMenuFunctional { + display: flex; + margin: 16px !important; +} + +.VOTMenuSelect { + width: 110px; + border-radius: 5px !important; + border: 1px solid #dadce0 !important; + box-shadow: 0 1px 3px -2px #9098a9; + box-sizing: border-box !important; + color: #2e2f34 !important; + background: #fff !important; + padding: 5px !important; +} + +.VOTMenuSelect:focus { + outline: none; +} + +.VOTMenuSelect:focus { + outline: none; + border-color: #0077ff; + box-shadow: 0 0 0 2px rgba(#0077ff, 0.2); +} + +#VOTSelectLanguages { + display: flex !important; + margin-left: 5px; +} + +#VOTSelectLanguages svg { + margin: 0 5px; +} +`, ""]); +// Exports +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___); + + +/***/ }), + +/***/ "./node_modules/css-loader/dist/runtime/api.js": +/***/ ((module) => { + + + +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +module.exports = function (cssWithMappingToString) { + var list = []; + + // return the list of modules as css string + list.toString = function toString() { + return this.map(function (item) { + var content = ""; + var needLayer = typeof item[5] !== "undefined"; + if (item[4]) { + content += "@supports (".concat(item[4], ") {"); + } + if (item[2]) { + content += "@media ".concat(item[2], " {"); + } + if (needLayer) { + content += "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {"); + } + content += cssWithMappingToString(item); + if (needLayer) { + content += "}"; + } + if (item[2]) { + content += "}"; + } + if (item[4]) { + content += "}"; + } + return content; + }).join(""); + }; + + // import a list of modules into the list + list.i = function i(modules, media, dedupe, supports, layer) { + if (typeof modules === "string") { + modules = [[null, modules, undefined]]; + } + var alreadyImportedModules = {}; + if (dedupe) { + for (var k = 0; k < this.length; k++) { + var id = this[k][0]; + if (id != null) { + alreadyImportedModules[id] = true; + } + } + } + for (var _k = 0; _k < modules.length; _k++) { + var item = [].concat(modules[_k]); + if (dedupe && alreadyImportedModules[item[0]]) { + continue; + } + if (typeof layer !== "undefined") { + if (typeof item[5] === "undefined") { + item[5] = layer; + } else { + item[1] = "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {").concat(item[1], "}"); + item[5] = layer; + } + } + if (media) { + if (!item[2]) { + item[2] = media; + } else { + item[1] = "@media ".concat(item[2], " {").concat(item[1], "}"); + item[2] = media; + } + } + if (supports) { + if (!item[4]) { + item[4] = "".concat(supports); + } else { + item[1] = "@supports (".concat(item[4], ") {").concat(item[1], "}"); + item[4] = supports; + } + } + list.push(item); + } + }; + return list; +}; + +/***/ }), + +/***/ "./node_modules/css-loader/dist/runtime/noSourceMaps.js": +/***/ ((module) => { + + + +module.exports = function (i) { + return i[1]; +}; + +/***/ }), + +/***/ "./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js": +/***/ ((module) => { + + + +var stylesInDOM = []; +function getIndexByIdentifier(identifier) { + var result = -1; + for (var i = 0; i < stylesInDOM.length; i++) { + if (stylesInDOM[i].identifier === identifier) { + result = i; + break; + } + } + return result; +} +function modulesToDom(list, options) { + var idCountMap = {}; + var identifiers = []; + for (var i = 0; i < list.length; i++) { + var item = list[i]; + var id = options.base ? item[0] + options.base : item[0]; + var count = idCountMap[id] || 0; + var identifier = "".concat(id, " ").concat(count); + idCountMap[id] = count + 1; + var indexByIdentifier = getIndexByIdentifier(identifier); + var obj = { + css: item[1], + media: item[2], + sourceMap: item[3], + supports: item[4], + layer: item[5] + }; + if (indexByIdentifier !== -1) { + stylesInDOM[indexByIdentifier].references++; + stylesInDOM[indexByIdentifier].updater(obj); + } else { + var updater = addElementStyle(obj, options); + options.byIndex = i; + stylesInDOM.splice(i, 0, { + identifier: identifier, + updater: updater, + references: 1 + }); + } + identifiers.push(identifier); + } + return identifiers; +} +function addElementStyle(obj, options) { + var api = options.domAPI(options); + api.update(obj); + var updater = function updater(newObj) { + if (newObj) { + if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap && newObj.supports === obj.supports && newObj.layer === obj.layer) { + return; + } + api.update(obj = newObj); + } else { + api.remove(); + } + }; + return updater; +} +module.exports = function (list, options) { + options = options || {}; + list = list || []; + var lastIdentifiers = modulesToDom(list, options); + return function update(newList) { + newList = newList || []; + for (var i = 0; i < lastIdentifiers.length; i++) { + var identifier = lastIdentifiers[i]; + var index = getIndexByIdentifier(identifier); + stylesInDOM[index].references--; + } + var newLastIdentifiers = modulesToDom(newList, options); + for (var _i = 0; _i < lastIdentifiers.length; _i++) { + var _identifier = lastIdentifiers[_i]; + var _index = getIndexByIdentifier(_identifier); + if (stylesInDOM[_index].references === 0) { + stylesInDOM[_index].updater(); + stylesInDOM.splice(_index, 1); + } + } + lastIdentifiers = newLastIdentifiers; + }; +}; + +/***/ }), + +/***/ "./node_modules/style-loader/dist/runtime/insertBySelector.js": +/***/ ((module) => { + + + +var memo = {}; + +/* istanbul ignore next */ +function getTarget(target) { + if (typeof memo[target] === "undefined") { + var styleTarget = document.querySelector(target); + + // Special case to return head of iframe instead of iframe itself + if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) { + try { + // This will throw an exception if access to iframe is blocked + // due to cross-origin restrictions + styleTarget = styleTarget.contentDocument.head; + } catch (e) { + // istanbul ignore next + styleTarget = null; + } + } + memo[target] = styleTarget; + } + return memo[target]; +} + +/* istanbul ignore next */ +function insertBySelector(insert, style) { + var target = getTarget(insert); + if (!target) { + throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid."); + } + target.appendChild(style); +} +module.exports = insertBySelector; + +/***/ }), + +/***/ "./node_modules/style-loader/dist/runtime/insertStyleElement.js": +/***/ ((module) => { + + + +/* istanbul ignore next */ +function insertStyleElement(options) { + var element = document.createElement("style"); + options.setAttributes(element, options.attributes); + options.insert(element, options.options); + return element; +} +module.exports = insertStyleElement; + +/***/ }), + +/***/ "./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js": +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + + + +/* istanbul ignore next */ +function setAttributesWithoutAttributes(styleElement) { + var nonce = true ? __webpack_require__.nc : 0; + if (nonce) { + styleElement.setAttribute("nonce", nonce); + } +} +module.exports = setAttributesWithoutAttributes; + +/***/ }), + +/***/ "./node_modules/style-loader/dist/runtime/styleDomAPI.js": +/***/ ((module) => { + + + +/* istanbul ignore next */ +function apply(styleElement, options, obj) { + var css = ""; + if (obj.supports) { + css += "@supports (".concat(obj.supports, ") {"); + } + if (obj.media) { + css += "@media ".concat(obj.media, " {"); + } + var needLayer = typeof obj.layer !== "undefined"; + if (needLayer) { + css += "@layer".concat(obj.layer.length > 0 ? " ".concat(obj.layer) : "", " {"); + } + css += obj.css; + if (needLayer) { + css += "}"; + } + if (obj.media) { + css += "}"; + } + if (obj.supports) { + css += "}"; + } + var sourceMap = obj.sourceMap; + if (sourceMap && typeof btoa !== "undefined") { + css += "\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), " */"); + } + + // For old IE + /* istanbul ignore if */ + options.styleTagTransform(css, styleElement, options.options); +} +function removeStyleElement(styleElement) { + // istanbul ignore if + if (styleElement.parentNode === null) { + return false; + } + styleElement.parentNode.removeChild(styleElement); +} + +/* istanbul ignore next */ +function domAPI(options) { + if (typeof document === "undefined") { + return { + update: function update() {}, + remove: function remove() {} + }; + } + var styleElement = options.insertStyleElement(options); + return { + update: function update(obj) { + apply(styleElement, options, obj); + }, + remove: function remove() { + removeStyleElement(styleElement); + } + }; +} +module.exports = domAPI; + +/***/ }), + +/***/ "./node_modules/style-loader/dist/runtime/styleTagTransform.js": +/***/ ((module) => { + + + +/* istanbul ignore next */ +function styleTagTransform(css, styleElement) { + if (styleElement.styleSheet) { + styleElement.styleSheet.cssText = css; + } else { + while (styleElement.firstChild) { + styleElement.removeChild(styleElement.firstChild); + } + styleElement.appendChild(document.createTextNode(css)); + } +} +module.exports = styleTagTransform; + +/***/ }), + +/***/ "./src/config/config-cloudflare.js": +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ I: () => (/* binding */ yandexHmacKey), +/* harmony export */ i: () => (/* binding */ workerHost) +/* harmony export */ }); +// CLOUDFLARE CONFIGURATION +const workerHost = "vot.toil-dump.workers.dev"; +const yandexHmacKey = "gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"; + + + + +/***/ }), + +/***/ "./src/config/config.js": +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ IM: () => (/* binding */ autoVolume), +/* harmony export */ Rr: () => (/* binding */ yandexUserAgent) +/* harmony export */ }); +/* unused harmony exports workerHost, yandexHmacKey */ +// CONFIGURATION +const workerHost = "api.browser.yandex.ru"; +const yandexHmacKey = "gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"; +const yandexUserAgent = + "Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1"; +const autoVolume = 0.15; // 0.0 - 1.0 (0% - 100%) - default volume of the video with the translation + + + + +/***/ }), + +/***/ "./src/config/constants.js": +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Iz: () => (/* binding */ translations), +/* harmony export */ ey: () => (/* binding */ translateFuncParam), +/* harmony export */ g$: () => (/* binding */ siteTranslates), +/* harmony export */ tW: () => (/* binding */ availableLangs) +/* harmony export */ }); +const translateFuncParam = 0x40_75_50_00_00_00_00_00; +const availableLangs = { + ru: "Russian", + en: "English", + zh: "Chinese", + fr: "French", + it: "Italian", + es: "Spanish", + de: "German", +}; // available languages for translation +const siteTranslates = { + youtube: "https://youtu.be/", + twitch: "https://twitch.tv/", + vimeo: "https://vimeo.com/", + "9gag": "https://9gag.com/gag/", + vk: "https://vk.com/video?z=", + xvideos: "https://www.xvideos.com/", + pornhub: "https://rt.pornhub.com/view_video.php?viewkey=", + udemy: "https://www.udemy.com", + twitter: "https://twitter.com/i/status/", + facebook: "https://www.facebook.com/", + rutube: "https://rutube.ru/video/", + "bilibili.com": "https://www.bilibili.com/video/", + "mail.ru": "https://my.mail.ru/", + coub: "https://coub.com/view/", +}; +const translations = { + ru: { + recommended: "рекомендуется", + translateVideo: "Перевести видео", + disableTranslate: "Выключить", + translationSettings: "Настройки перевода", + resetSettings: "Сбросить настройки", + videoBeingTranslated: "Видео переводится", + videoLanguage: "Язык видео", + translationLanguage: "Язык перевода", + translationTake: "Перевод займёт", + translationTakeMoreThanHour: "Перевод займёт больше часа", + translationTakeAboutMinute: "Перевод займёт около минуты", + translationTakeFewMinutes: "Перевод займёт несколько минут", + translationTakeApproximatelyMinutes: "Перевод займёт примерно {0} минут", + translationTakeApproximatelyMinute: "Перевод займёт примерно {0} минуты", + unSupportedExtensionError: `Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`, + requestTranslationFailed: "Не удалось запросить перевод видео", + audioNotReceived: "Не получена ссылка на аудио", + grantPermissionToAutoPlay: "Предоставьте разрешение на автовоспроизведение", + neededAdditionalExtension: + "Для поддержки этого сайта необходимо дополнительное расширение", + audioFormatNotSupported: "Формат аудио не поддерживается", + VOTAutoTranslate: "Переводить при открытии", + VOTDontTranslateYourLang: "Не переводить с родного языка", + VOTVolume: "Громкость видео", + VOTVolumeTranslation: "Громкость перевода", + VOTAutoSetVolume: "Уменьшать громкость видео до ", + VOTShowVideoSlider: "Слайдер громкости видео", + VOTSyncVolume: "Связать громкость перевода и видео", + VOTAudioProxy: "Проксировать полученное аудио", + VOTDisableFromYourLang: "VOT: Вы отключили перевод видео на вашем языке", + VOTLiveNotSupported: + "VOT: Не поддерживается перевод трансляций в прямом эфире", + VOTPremiere: "VOT: Дождитесь окончания премьеры перед переводом", + VOTVideoIsTooLong: "VOT: Видео слишком длинное", + VOTNoVideoIDFound: "VOT: Не найдено ID видео", + VOTFailedInitDB: "VOT: Не удалось инициализовать базу данных", + VOTDBNeedUpdate: + "VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу", + VOTDisabledForDBUpdating: `VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`, + VOTFailedWriteToDB: "VOT: Не удалось записать данные в базу данных", + VOTFailedReadFromDB: "VOT: Не удалось получить данные из базы данных", + Russian: "Русский", + English: "Английский", + Chinese: "Китайский", + French: "Французский", + Italian: "Итальянский", + Spanish: "Испанский", + German: "Немецкий", + }, + en: { + recommended: "recommended", + translateVideo: "Translate video", + disableTranslate: "Turn off", + translationSettings: "Translation settings", + resetSettings: "Reset settings", + videoBeingTranslated: "The video is being translated", + videoLanguage: "Video language", + translationLanguage: "Translation language", + translationTake: "The translation will take", + translationTakeMoreThanHour: "The translation will take more than an hour", + translationTakeAboutMinute: "The translation will take about a minute", + translationTakeFewMinutes: "The translation will take a few minutes", + translationTakeApproximatelyMinutes: + "The translation will take approximately {0} minutes", + translationTakeApproximatelyMinute: + "The translation will take approximately {0} minutes", + unSupportedExtensionError: `Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`, + requestTranslationFailed: "Failed to request video translation", + audioNotReceived: "Audio link not received", + grantPermissionToAutoPlay: "Grant permission to autoplay", + neededAdditionalExtension: + "An additional extension is needed to support this site", + audioFormatNotSupported: "The audio format is not supported", + VOTAutoTranslate: "Translate on open", + VOTDontTranslateYourLang: "Do not translate from my language", + VOTVolume: "Video volume", + VOTVolumeTranslation: "Translation Volume", + VOTAutoSetVolume: "Reduce video volume to ", + VOTShowVideoSlider: "Video volume slider", + VOTSyncVolume: "Link translation and video volume", + VOTAudioProxy: "Proxy received audio", + VOTDisableFromYourLang: + "VOT: You have disabled the translation of the video in your language", + VOTLiveNotSupported: "VOT: Translation of live streams is not supported", + VOTPremiere: "VOT: Wait for the premiere to end before translating", + VOTVideoIsTooLong: "VOT: Video is too long", + VOTNoVideoIDFound: "VOT: No video ID found", + VOTFailedInitDB: "VOT: Failed to initialize database", + VOTDBNeedUpdate: + "VOT: The database needs an update, please reload the page", + VOTDisabledForDBUpdating: `VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`, + VOTFailedWriteToDB: "VOT: Data could not be written to the database", + VOTFailedReadFromDB: "VOT: Data could not be retrieved from the database", + Russian: "Russian", + English: "English", + Chinese: "Chinese", + French: "French", + Italian: "Italian", + Spanish: "Spanish", + German: "German", + }, + zh: { + recommended: "推荐使用", + translateVideo: "翻译视频", + disableTranslate: "关掉", + translationSettings: "翻译需要一个多小时", + resetSettings: "重置设置", + videoBeingTranslated: "视频正在翻译中", + videoLanguage: "视频语言", + translationLanguage: "翻译语言", + translationTake: "翻译将采取", + translationTakeMoreThanHour: "翻译将采取一个多小时", + translationTakeAboutMinute: "翻译将采取一分钟", + translationTakeFewMinutes: "翻译将采取几分钟", + translationTakeApproximatelyMinutes: "翻译将采取大约需要{0}分钟", + translationTakeApproximatelyMinute: "翻译将采取大约需要{0}分钟", + unSupportedExtensionError: `错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`, + requestTranslationFailed: "请求视频翻译失败", + audioNotReceived: "未收到音频链接", + grantPermissionToAutoPlay: "授予自动播放权限", + neededAdditionalExtension: "需要一个额外的扩展来支持这个网站", + audioFormatNotSupported: "不支持音频格式", + VOTAutoTranslate: "打开时翻译", + VOTDontTranslateYourLang: "不要从你的语言翻译过来", + VOTVolume: "视频量", + VOTVolumeTranslation: "翻译量", + VOTAutoSetVolume: "将视频音量降低到", + VOTShowVideoSlider: "视频音量滑块", + VOTSyncVolume: "链接翻译和视频音量", + VOTAudioProxy: "代理接收的音频", + VOTDisableFromYourLang: "VOT:你已经禁用了你的语言的视频翻译", + VOTLiveNotSupported: "VOT:不支持直播流的翻译", + VOTPremiere: "VOT:等待首映结束后再翻译", + VOTVideoIsTooLong: "VOT:视频太长", + VOTNoVideoIDFound: "VOT: 没有找到视频ID", + VOTFailedInitDB: "VOT: 初始化数据库失败", + VOTDBNeedUpdate: "VOT: 数据库需要更新,请重新加载页面", + VOTDisabledForDBUpdating: `VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`, + VOTFailedWriteToDB: "VOT: 无法将数据写入数据库", + VOTFailedReadFromDB: "VOT: 无法从数据库中检索数据", + Russian: "俄语", + English: "英语", + Chinese: "中文", + French: "法语", + Italian: "意大利语", + Spanish: "西班牙语", + German: "德语", + }, + de: { + recommended: "es wird empfohlen", + translateVideo: "Video übersetzen", + disableTranslate: "Ausschalten", + translationSettings: "Übersetzungseinstellungen", + resetSettings: "Einstellungen zurücksetzen", + videoBeingTranslated: "Das Video wird übersetzt", + videoLanguage: "Sprache Video", + translationLanguage: "Zielsprache", + translationTake: "Die Übersetzung dauert", + translationTakeMoreThanHour: "Die Übersetzung dauert mehr als eine Stunde", + translationTakeAboutMinute: "Die Übersetzung dauert ungefähr eine Minute", + translationTakeFewMinutes: "Die Übersetzung dauert einige Minuten", + translationTakeApproximatelyMinutes: + "Die Übersetzung dauert ungefähr {0} Minuten", + translationTakeApproximatelyMinute: + "Die Übersetzung dauert ungefähr {0} Minuten", + unSupportedExtensionError: `Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`, + requestTranslationFailed: + "Videoübersetzung konnte nicht angefordert werden", + audioNotReceived: "Audiolink nicht empfangen", + grantPermissionToAutoPlay: + "Erteilen Sie die Berechtigung zur automatischen Wiedergabe", + neededAdditionalExtension: + "Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen", + audioFormatNotSupported: "Das Audioformat wird nicht unterstützt", + VOTAutoTranslate: "Beim Öffnen übersetzen", + VOTDontTranslateYourLang: "Nicht aus Ihrer Sprache übersetzen", + VOTVolume: "Video Lautstärke", + VOTVolumeTranslation: "Übersetzungsvolumen", + VOTAutoSetVolume: "Video-Lautstärke auf reduzieren ", + VOTShowVideoSlider: "Video-Lautstärkeregler", + VOTSyncVolume: "Übersetzungs- und Videolautstärke verknüpfen", + VOTAudioProxy: "Empfangenes Audio proxyen", + VOTDisableFromYourLang: + "VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert", + VOTLiveNotSupported: + "VOT: Übersetzung von Live-Streams wird nicht unterstützt", + VOTPremiere: + "VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen", + VOTVideoIsTooLong: "VOT: Video ist zu lang", + VOTNoVideoIDFound: "VOT: Keine Video-ID gefunden", + VOTFailedInitDB: "VOT: Datenbank konnte nicht initialisiert werden", + VOTDBNeedUpdate: + "VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu", + VOTDisabledForDBUpdating: `VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`, + VOTFailedWriteToDB: + "VOT: Daten konnten nicht in die Datenbank geschrieben werden", + VOTFailedReadFromDB: "VOT: Konnte keine Daten aus der Datenbank abrufen", + Russian: "Russisch", + English: "Englisch", + Chinese: "Chinesisch", + French: "Französisch", + Italian: "Italienisch", + Spanish: "Spanisch", + German: "Deutsch", + }, + es: { + recommended: "es recomendable", + translateVideo: "Traducir video", + disableTranslate: "Apagar", + translationSettings: "Ajustes de traducción", + resetSettings: "Restablecer ajustes", + videoBeingTranslated: "El video está siendo traducido", + videoLanguage: "Idioma del video", + translationLanguage: "Idioma de la traducción", + translationTake: "La traducción tardará", + translationTakeMoreThanHour: "La traducción tardará más de una hora", + translationTakeAboutMinute: + "La traducción tardará aproximadamente un minuto", + translationTakeFewMinutes: "La traducción tardará unos minutos", + translationTakeApproximatelyMinutes: + "La traducción tardará aproximadamente {0} minutos", + translationTakeApproximatelyMinute: + "La traducción tardará aproximadamente {0} minutos", + unSupportedExtensionError: `Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`, + requestTranslationFailed: "Error al solicitar la traducción de vídeo", + audioNotReceived: "Audiolink nicht empfangen", + grantPermissionToAutoPlay: "Conceder permiso de reproducción automática", + neededAdditionalExtension: + "Se necesita una extensión adicional para admitir este sitio", + audioFormatNotSupported: "El formato de audio no es compatible", + VOTAutoTranslate: "Traducir al abrir", + VOTDontTranslateYourLang: "No traduzca de su lengua", + VOTVolume: "Volumen de vídeo", + VOTVolumeTranslation: "Volumen de traducción", + VOTAutoSetVolume: "Reducir el volumen del video al ", + VOTShowVideoSlider: "Deslizador de volumen de video", + VOTSyncVolume: "Vincular el volumen de traducción y video", + VOTAudioProxy: "Proxificar el audio recibido", + VOTDisableFromYourLang: + "VOT: Ha desactivado la traducción del vídeo en su idioma", + VOTLiveNotSupported: + "VOT: No se admite la traducción de transmisiones en vivo", + VOTPremiere: "VOT: Espere a que termine el estreno antes de traducir", + VOTVideoIsTooLong: "VOT: El video es demasiado largo", + VOTNoVideoIDFound: "VOT: No se encontró id de video", + VOTFailedInitDB: "VOT: No se pudo inicializar la base de datos", + VOTDBNeedUpdate: + "VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página", + VOTDisabledForDBUpdating: `VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`, + VOTFailedWriteToDB: "VOT: No se pudo escribir datos en la base de datos", + VOTFailedReadFromDB: "VOT: No se pudo recuperar datos de la base de datos", + Russian: "Ruso", + English: "Inglés", + Chinese: "Chino", + French: "Francés", + Italian: "Italiano", + Spanish: "Español", + German: "Alemán", + }, + fr: { + recommended: "recommande", + translateVideo: "Traduire la vidéo", + disableTranslate: "Désactiver", + translationSettings: "Paramètres de traduction", + resetSettings: "Réinitialiser les paramètres", + videoBeingTranslated: "La vidéo est en cours de traduction", + videoLanguage: "Langue vidéo", + translationLanguage: "Langue cible", + translationTake: "La traduction prendra", + translationTakeMoreThanHour: "La traduction prendra plus d'une heure", + translationTakeAboutMinute: "La traduction prendra environ une minute", + translationTakeFewMinutes: "La traduction prendra quelques minutes", + translationTakeApproximatelyMinutes: + "La traduction prendra environ {0} minutes", + translationTakeApproximatelyMinute: + "La traduction prendra environ {0} minutes", + unSupportedExtensionError: `Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`, + requestTranslationFailed: + "Impossible de demander la traduction de la vidéo", + audioNotReceived: "Lien audio non reçu", + grantPermissionToAutoPlay: "Accorder l'autorisation de lecture automatique", + neededAdditionalExtension: + "Une extension supplémentaire est nécessaire pour prendre en charge ce site", + audioFormatNotSupported: "Format audio non pris en charge", + VOTAutoTranslate: "Traduire à l'ouverture", + VOTDontTranslateYourLang: "Ne pas traduire à partir de votre langue", + VOTVolume: "Volume de la vidéo", + VOTVolumeTranslation: "Volume de traduction", + VOTAutoSetVolume: "Réduire le volume de la vidéo à ", + VOTShowVideoSlider: "Curseur de volume vidéo", + VOTSyncVolume: "Lier le volume de la traduction et de la vidéo", + VOTAudioProxy: "Proxy audio reçu", + VOTDisableFromYourLang: + "VOT: Vous avez désactivé la traduction de la vidéo dans votre langue", + VOTLiveNotSupported: + "VOT: La traduction des flux en direct n'est pas prise en charge", + VOTPremiere: "VOT: Attendez la fin de la première avant de traduire", + VOTVideoIsTooLong: "VOT: La vidéo est trop longue", + VOTNoVideoIDFound: "VOT: ID vidéo introuvable", + VOTFailedInitDB: "VOT: Impossible d'initialiser la base de données", + VOTDBNeedUpdate: + "VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page", + VOTDisabledForDBUpdating: `VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`, + VOTFailedWriteToDB: + "VOT: Impossible d'écrire les données dans la base de données", + VOTFailedReadFromDB: + "VOT: Impossible de récupérer les données de la base de données", + Russian: "Russe", + English: "Anglais", + Chinese: "Chinois", + French: "Français", + Italian: "Italien", + Spanish: "Espagnol", + German: "Allemand", + }, + it: { + recommended: "è consigliabile", + translateVideo: "Traduci il video", + disableTranslate: "Spegnere", + translationSettings: "Impostazioni di traduzione", + resetSettings: "Ripristina impostazioni", + videoBeingTranslated: "Il video è in fase di traduzione", + videoLanguage: "Lingua Video", + translationLanguage: "Lingua di traduzione", + translationTake: "La traduzione richiederà", + translationTakeMoreThanHour: "La traduzione richiederà più di un'ora", + translationTakeAboutMinute: "La traduzione richiederà circa un minuto", + translationTakeFewMinutes: "La traduzione richiederà alcuni minuti", + translationTakeApproximatelyMinutes: + "La traduzione richiederà circa {0} minuti", + translationTakeApproximatelyMinute: + "La traduzione richiederà circa {0} minuti", + unSupportedExtensionError: `Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`, + requestTranslationFailed: "Richiesta di traduzione video non riuscita", + audioNotReceived: "Collegamento audio non ricevuto", + grantPermissionToAutoPlay: + "Concedere l'Autorizzazione per la riproduzione automatica", + neededAdditionalExtension: + "Per supportare questo sito è necessaria un'estensione aggiuntiva", + audioFormatNotSupported: "Il formato audio non è supportato", + VOTAutoTranslate: "Traduci all'apertura", + VOTDontTranslateYourLang: "Non traducete dalla vostra lingua", + VOTVolume: "Volume video", + VOTVolumeTranslation: "Volume di traduzione", + VOTAutoSetVolume: "Riduci il volume del video al ", + VOTShowVideoSlider: "Cursore del volume del video", + VOTSyncVolume: "Collega il volume della traduzione e del video", + VOTAudioProxy: "Proxy audio ricevuto", + VOTDisableFromYourLang: + "VOT: Avete disabilitato la traduzione del video nella vostra lingua", + VOTLiveNotSupported: + "VOT: La traduzione dei flussi dal vivo non è supportata", + VOTPremiere: "VOT: Aspetta che la prima finisca prima di tradurre", + VOTVideoIsTooLong: "VOT: Il video è troppo lungo", + VOTNoVideoIDFound: "VOT: ID video non trovato", + VOTFailedInitDB: "VOT: Impossibile inizializzare il database", + VOTDBNeedUpdate: + "VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina", + VOTDisabledForDBUpdating: `VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`, + VOTFailedWriteToDB: "VOT: Impossibile scrivere dati nel database", + VOTFailedReadFromDB: "VOT: Impossibile recuperare i dati dal database", + Russian: "Russo", + English: "Inglese", + Chinese: "Cinese", + French: "Francese", + Italian: "Italiano", + Spanish: "Spagnolo", + German: "Tedesco", + }, +}; + + + + +/***/ }), + +/***/ "./src/rvt-cloudflare.js": +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +// ESM COMPAT FLAG +__webpack_require__.r(__webpack_exports__); + +// EXPORTS +__webpack_require__.d(__webpack_exports__, { + "default": () => (/* binding */ rvt_cloudflare) +}); + +;// CONCATENATED MODULE: ./src/getUUID.js +function getUUID(isLower) { + const uuid = ([1e7] + 1e3 + 4e3 + 8e3 + 1e11).replace(/[018]/g, (c) => + ( + c ^ + (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4))) + ).toString(16) + ); + return isLower ? uuid : uuid.toUpperCase(); +} + + + +// EXTERNAL MODULE: ./src/yandexRequests.js +var yandexRequests = __webpack_require__("./src/yandexRequests.js"); +// EXTERNAL MODULE: ./src/config/config-cloudflare.js +var config_cloudflare = __webpack_require__("./src/config/config-cloudflare.js"); +// EXTERNAL MODULE: ./src/config/config.js +var config = __webpack_require__("./src/config/config.js"); +// EXTERNAL MODULE: ./src/utils/debug.js +var debug = __webpack_require__("./src/utils/debug.js"); +;// CONCATENATED MODULE: ./src/rvt-cloudflare.js + + + + + + +// Request video translation from Yandex API +async function requestVideoTranslation( + url, + unknown1, + requestLang, + responseLang, + callback +) { + // Initialize variables + let response; + let responseBody; + const deviceId = getUUID(true); + const body = yandexRequests/* yandexRequests */.G.encodeRequest( + url, + deviceId, + unknown1, + requestLang, + responseLang + ); + + try { + debug/* default */.Z.log("requestVideoTranslation"); + // Create a key from the HMAC secret + const utf8Encoder = new TextEncoder("utf-8"); + const key = await window.crypto.subtle.importKey( + "raw", + utf8Encoder.encode(config_cloudflare/* yandexHmacKey */.I), + { name: "HMAC", hash: { name: "SHA-256" } }, + false, + ["sign", "verify"] + ); + // Sign the body with the key + const signature = await window.crypto.subtle.sign("HMAC", key, body); + // Convert the signature to a hex string + const hexSignature = Array.from(new Uint8Array(signature), (x) => + x.toString(16).padStart(2, "0") + ).join(""); + // Create a fetch options object with headers and body + const options = { + method: "POST", + mode: "cors", + cache: "no-cache", + headers: { + "Content-Type": "application/json", + }, + redirect: "follow", + referrerPolicy: "no-referrer", + body: JSON.stringify({ + headers: { + Accept: "application/x-protobuf", + "Accept-Language": "en", + "Content-Type": "application/x-protobuf", + "User-Agent": config/* yandexUserAgent */.Rr, + Pragma: "no-cache", + "Cache-Control": "no-cache", + "Sec-Fetch-Mode": "no-cors", + "Vtrans-Signature": hexSignature, + "Sec-Vtrans-Token": getUUID(false), + }, + body: String.fromCharCode(...body), + }), + }; + // Fetch the translation from the worker host + response = await fetch( + `https://${config_cloudflare/* workerHost */.i}/video-translation/translate`, + options + ); + // Get the response body as an array buffer + responseBody = await response.arrayBuffer(); + } catch (exception) { + debug/* default */.Z.log(exception); + // Handle errors + response = { status: -1 }; + responseBody = exception; + } + + // Call the callback function with the result + callback(response.status == 200, responseBody); +} + +/* harmony default export */ const rvt_cloudflare = (requestVideoTranslation); + + +/***/ }), + +/***/ "./src/utils/debug.js": +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _config_constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./src/config/constants.js"); + + +const debug = {}; +debug.log = (...text) => { + if (true) { + return; + } + return console.log( + "%c[VOT DEBUG]", + "background: #F2452D; color: #fff; padding: 5px;", + ...text + ); +}; + +debug.translations = (testLang) => { + if (true) { + return; + } + // for add indexes + const testedTranslations = Object.entries(_config_constants_js__WEBPACK_IMPORTED_MODULE_0__/* .translations */ .Iz[testLang]).map( + ([key, value]) => ({ + phrase: key, + translated: value, + }) + ); + testedTranslations.unshift({ + phrase: "language_code (debug only)", + translated: testLang, + }); + return console.table(testedTranslations); +}; + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (debug); + + +/***/ }), + +/***/ "./src/yandexRequests.js": +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ G: () => (/* binding */ yandexRequests) +/* harmony export */ }); +const VideoTranslationRequest = new protobuf.Type("VideoTranslationRequest") + .add(new protobuf.Field("url", 3, "string")) + .add(new protobuf.Field("deviceId", 4, "string")) + .add(new protobuf.Field("firstRequest", 5, "bool")) // true for the first request, false for subsequent ones + .add(new protobuf.Field("unknown1", 6, "fixed64")) + .add(new protobuf.Field("unknown2", 7, "int32")) // 1 1 + .add(new protobuf.Field("language", 8, "string")) // source language code + .add(new protobuf.Field("unknown3", 9, "int32")) // 0 0 + .add(new protobuf.Field("unknown4", 10, "int32")) // 0 0 + .add(new protobuf.Field("translationHelp", 11, "int32")) // array for translation assistance ([0] -> {2: link to video, 1: "video_file_url"}, [1] -> {2: link to subtitles, 1: "subtitles_file_url"}) + .add(new protobuf.Field("responseLanguage", 14, "string")); // target language code + +// const VideoWhitelistStreamRequest = new protobuf.Type("VideoWhitelistStreamRequest") +// .add(new protobuf.Field("url", 1, "string")) +// .add(new protobuf.Field("deviceId", 4, "string")) + +// const VideoTranslationStreamRequest = new protobuf.Type("VideoTranslationStreamRequest") +// .add(new protobuf.Field("url", 1, "string")) +// .add(new protobuf.Field("language", 2, "string")) +// .add(new protobuf.Field("responseLanguage", 3, "string")) + +const VideoTranslationResponse = new protobuf.Type("VideoTranslationResponse") + .add(new protobuf.Field("url", 1, "string")) + .add(new protobuf.Field("duration", 2, "double")) + .add(new protobuf.Field("status", 4, "int32")) // status + .add(new protobuf.Field("remainingTime", 5, "int32")) // secs before translation + .add(new protobuf.Field("language", 8, "string")) // detected language (if the wrong one is set) + .add(new protobuf.Field("message", 9, "string")); +// 6 - unknown 0 (1st request) -> 10 (2nd, 3th and etc requests) +// 7 - unknown array + +// const VideoWhitelistStreamResponse = new protobuf.Type("VideoWhitelistStreamResponse") +// .add(new protobuf.Field("inWhitelist", 1, "bool")) + +// const VideoTranslationStreamResponse = new protobuf.Type("VideoTranslationStreamResponse") +// .add(new protobuf.Field("unknown1", 1, "int32")) +// .add(new protobuf.Field("array", 2, "string")) +// .add(new protobuf.Field("ping", 3, "int32")) + +// Create a root namespace and add the types +// const root = new protobuf.Root().define("yandex").add(VideoWhitelistStreamRequest).add(VideoWhitelistStreamResponse); + +// // Export the encoding and decoding functions +// export const yandexRequests = { +// encodeRequest(url, deviceId, unknown1, requestLang, responseLang) { +// return root.VideoWhitelistStreamRequest.encode({ +// url, +// deviceId: 'UCLA_DiR1FfKNvjuUpBHmylQ' +// }).finish(); +// }, +// decodeResponse(response) { +// return root.VideoWhitelistStreamResponse.decode(new Uint8Array(response)); +// } +// }; + +// // Create a root namespace and add the types +// const root = new protobuf.Root().define("yandex").add(VideoTranslationStreamRequest).add(VideoTranslationStreamResponse); + +// // Export the encoding and decoding functions +// export const yandexRequests = { +// encodeRequest(url, deviceId, unknown1, requestLang, responseLang) { +// return root.VideoTranslationStreamRequest.encode({ +// url, +// language: requestLang, +// responseLanguage: responseLang +// }).finish(); +// }, +// decodeResponse(response) { +// return root.VideoTranslationStreamResponse.decode(new Uint8Array(response)); +// } +// }; + +// Create a root namespace and add the types +const root = new protobuf.Root() + .define("yandex") + .add(VideoTranslationRequest) + .add(VideoTranslationResponse); + +// Export the encoding and decoding functions +const yandexRequests = { + encodeRequest(url, deviceId, unknown1, requestLang, responseLang) { + return root.VideoTranslationRequest.encode({ + url, + deviceId, + firstRequest: true, + unknown1, + unknown2: 1, + language: requestLang, + unknown3: 0, + unknown4: 0, + responseLanguage: responseLang, + }).finish(); + }, + decodeResponse(response) { + return root.VideoTranslationResponse.decode(new Uint8Array(response)); + }, +}; + + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ id: moduleId, +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/compat get default export */ +/******/ (() => { +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = (module) => { +/******/ var getter = module && module.__esModule ? +/******/ () => (module['default']) : +/******/ () => (module); +/******/ __webpack_require__.d(getter, { a: getter }); +/******/ return getter; +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/define property getters */ +/******/ (() => { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ (() => { +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ (() => { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = (exports) => { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/nonce */ +/******/ (() => { +/******/ __webpack_require__.nc = undefined; +/******/ })(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. +(() => { + +// EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js +var injectStylesIntoStyleTag = __webpack_require__("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"); +var injectStylesIntoStyleTag_default = /*#__PURE__*/__webpack_require__.n(injectStylesIntoStyleTag); +// EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/styleDomAPI.js +var styleDomAPI = __webpack_require__("./node_modules/style-loader/dist/runtime/styleDomAPI.js"); +var styleDomAPI_default = /*#__PURE__*/__webpack_require__.n(styleDomAPI); +// EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/insertBySelector.js +var insertBySelector = __webpack_require__("./node_modules/style-loader/dist/runtime/insertBySelector.js"); +var insertBySelector_default = /*#__PURE__*/__webpack_require__.n(insertBySelector); +// EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js +var setAttributesWithoutAttributes = __webpack_require__("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"); +var setAttributesWithoutAttributes_default = /*#__PURE__*/__webpack_require__.n(setAttributesWithoutAttributes); +// EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/insertStyleElement.js +var insertStyleElement = __webpack_require__("./node_modules/style-loader/dist/runtime/insertStyleElement.js"); +var insertStyleElement_default = /*#__PURE__*/__webpack_require__.n(insertStyleElement); +// EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/styleTagTransform.js +var styleTagTransform = __webpack_require__("./node_modules/style-loader/dist/runtime/styleTagTransform.js"); +var styleTagTransform_default = /*#__PURE__*/__webpack_require__.n(styleTagTransform); +// EXTERNAL MODULE: ./node_modules/css-loader/dist/cjs.js!./src/styles/main.css +var main = __webpack_require__("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"); +;// CONCATENATED MODULE: ./src/styles/main.css + + + + + + + + + + + +var options = {}; + +options.styleTagTransform = (styleTagTransform_default()); +options.setAttributes = (setAttributesWithoutAttributes_default()); + + options.insert = insertBySelector_default().bind(null, "head"); + +options.domAPI = (styleDomAPI_default()); +options.insertStyleElement = (insertStyleElement_default()); + +var update = injectStylesIntoStyleTag_default()(main/* default */.Z, options); + + + + + /* harmony default export */ const styles_main = (main/* default */.Z && main/* default */.Z.locals ? main/* default */.Z.locals : undefined); + +;// CONCATENATED MODULE: ./src/utils/getYTVideoData.js +async function detect(cleanText) { + const response = await fetch("https://rust-server-531j.onrender.com/detect", { + method: "POST", + body: cleanText, + }); + return await response.text(); +} + +// Get the language code from the response or the text +async function getLanguage(player, response, title, description, author) { + if (!window.location.hostname.includes("m.youtube.com")) { + // ! Experimental ! get lang from selected audio track if availabled + const audioTracks = player.getAudioTrack(); + const trackInfo = audioTracks?.getLanguageInfo(); // get selected track info (id === "und" if tracks are not available) + if (trackInfo?.id !== "und") { + return trackInfo.id.split(".")[0]; + } + } + + // TODO: If the audio tracks will work fine, transfer the receipt of captions to the audioTracks variable + // Check if there is an automatic caption track in the response + const captionTracks = + response?.captions?.playerCaptionsTracklistRenderer?.captionTracks; + if (captionTracks?.length) { + const autoCaption = captionTracks.find((caption) => caption.kind === "asr"); + if (autoCaption) { + return autoCaption.languageCode; + } + } + // If there is no caption track, use detect to get the language code from the text + const text = [title, description, author].join(" "); + // Remove anything that is not a letter or a space in any language + const cleanText = text + .replace(/https?:\/\/\S+/g, "") + .replace(/[^\p{L}\s]/gu, "") + .trim() + .slice(0, 250); + return await detect(cleanText); +} + +// Get the video data from the player +async function getYTVideoData() { + const player = document.querySelector("#movie_player"); + const data = player.getVideoData(); + const response = player.getPlayerResponse(); + const { isLive, isPremiere, title, author } = data; + const { shortDescription: description } = response?.videoDetails ?? {}; + const videoData = { + isLive, + isPremiere, + title, + description, + author, + detectedLanguage: await getLanguage( + player, + response, + title, + description, + author + ), + }; + console.log("VOT Detected language: ", videoData.detectedLanguage); + return videoData; +} + + + +// EXTERNAL MODULE: ./src/yandexRequests.js +var yandexRequests = __webpack_require__("./src/yandexRequests.js"); +// EXTERNAL MODULE: ./src/config/constants.js +var constants = __webpack_require__("./src/config/constants.js"); +// EXTERNAL MODULE: ./src/utils/debug.js +var debug = __webpack_require__("./src/utils/debug.js"); +;// CONCATENATED MODULE: ./src/menu.js + + + +const userlang = navigator.language || navigator.userLanguage; +let lang = userlang.substr(0, 2).toLowerCase(); +if (!(lang in constants/* translations */.Iz)) { + lang = "en"; +} + +function changeBtnColor(n) { + document.querySelector(".translationBtn").style.color = n; +} + +function changeBtnState(newState = "none") { + document.querySelector(".translationBtn").dataset.state = newState; +} + +function changeIconBackground(type = "none") { + let iconBackgroundColor; + switch (type) { + case "error": + iconBackgroundColor = "#7A7A7D"; + break; + case "success": + iconBackgroundColor = "#A36EFF"; + break; + default: + iconBackgroundColor = "#FFFFFF"; + break; + } + + document.querySelector(".translateIcon").style.fill = iconBackgroundColor; +} + +function transformBtn(type = "none", text) { + switch (type) { + case "error": + changeIconBackground(type); + changeBtnColor("#7A7A7D"); + changeBtnState(type); + break; + case "success": + changeIconBackground(type); + changeBtnColor("#A36EFF"); + changeBtnState(type); + break; + default: + changeIconBackground("none"); + changeBtnColor("#FFFFFF"); + changeBtnState("none"); + break; + } + + document.querySelector(".translationBtn").innerText = text; +} + +// Add translation buttton block +function addTranslationBlock(element) { + if (!element || element.querySelector(".translationBlock")) return; + + const block = document.createElement("div"); + block.classList.add("translationBlock"); + block.innerHTML = ` + + + + + + + ${constants/* translations */.Iz[lang].translateVideo} + + + + + + + `; + + element.appendChild(block); + debug/* default */.Z.log("VOT: Added translation button to ", element); +} + +function createTranslationMenu() { + const container = document.createElement("div"); + container.classList.add("translationMenuContent"); + container.innerHTML = ` +

${constants/* translations */.Iz[lang].translationSettings}

+
+
+ + + + + + +
+ `; + + container.onclick = (event) => event.stopPropagation(); + return container; +} + +// Create checkbox for menu +function createMenuCheckbox(id, valueToCheck, content) { + const checkboxContainer = document.createElement("div"); + const checkbox = document.createElement("input"); + const checkboxLabel = document.createElement("label"); + + checkbox.type = "checkbox"; + checkbox.id = id; + checkbox.checked = Boolean(valueToCheck); + + checkboxLabel.htmlFor = id; + checkboxLabel.innerHTML = content; + + checkboxContainer.classList.add("translationMenuContainer"); + checkboxContainer.appendChild(checkbox); + checkboxContainer.appendChild(checkboxLabel); + + return checkboxContainer; +} + +// Create slider for menu +function createMenuSlider(id, sliderValue, content) { + const sliderContainer = document.createElement("div"); + const slider = document.createElement("input"); + const sliderLabel = document.createElement("label"); + + slider.type = "range"; + slider.id = id; + slider.classList.add("VOTMenuSlider"); + slider.min = 0; + slider.max = 100; + slider.value = sliderValue; + + sliderLabel.htmlFor = id; + sliderLabel.classList.add("translationHeader"); + sliderLabel.innerHTML = content; + + sliderContainer.classList.add("translationMenuContainer"); + sliderContainer.appendChild(sliderLabel); + sliderContainer.appendChild(slider); + + return sliderContainer; +} + +// Create select for menu +function createMenuSelect(id, selectOptions) { + // selectOptions structure: + // [ + // { + // label: string, + // value: string, + // selected: boolean, + // disabled: boolean + // } + // ] + const selectContainer = document.createElement("div"); + const select = document.createElement("select"); + + select.id = id; + select.classList.add("VOTMenuSelect"); + + for (const option of selectOptions) { + const optionElement = document.createElement("option"); + optionElement.innerText = option.label; + optionElement.value = option.value; + if ( + Object.prototype.hasOwnProperty.call(option, "selected") && + option.selected + ) { + optionElement.setAttribute("selected", "selected"); + } + + if (Object.prototype.hasOwnProperty.call(option, "disabled")) { + optionElement.disabled = option.disabled; + } + + select.appendChild(optionElement); + } + + selectContainer.classList.add("translationMenuContainer"); + selectContainer.appendChild(select); + + return selectContainer; +} + + + +;// CONCATENATED MODULE: ./src/utils/utils.js + + + +if (!String.prototype.format) { + // https://stackoverflow.com/questions/610406/javascript-equivalent-to-printf-string-format + // syntax example: "is {0} function".format("format") + String.prototype.format = function () { + // store arguments in an array + var args = arguments; + // use replace to iterate over the string + // select the match and check if the related argument is present + // if yes, replace the match with the argument + return this.replace(/{(\d+)}/g, function (match, index) { + // check if the argument is present + return typeof args[index] != "undefined" ? args[index] : match; + }); + }; +} + +function waitForElm(selector) { + // https://stackoverflow.com/questions/5525071/how-to-wait-until-an-element-exists + return new Promise((resolve) => { + const element = document.querySelector(selector); + if (element) { + return resolve(element); + } + + const observer = new MutationObserver(() => { + const element = document.querySelector(selector); + if (element) { + resolve(element); + observer.disconnect(); + } + }); + + observer.observe(document.body, { + childList: true, + subtree: true, + once: true, + }); + }); +} + +const sleep = (m) => new Promise((r) => setTimeout(r, m)); + +const getVideoId = (service) => { + const url = new URL(window.location.href); + + switch (service) { + case "youtube": + return ( + url.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1] || + url.searchParams.get("v") + ); + case "vk": + if (url.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)) { + return url.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1); + } else if (url.searchParams.get("z")) { + return url.searchParams.get("z").split("/")[0]; + } else if (url.searchParams.get("oid") && url.searchParams.get("id")) { + return `video-${Math.abs( + url.searchParams.get("oid") + )}_${url.searchParams.get("id")}`; + } else { + return false; + } + case "9gag": + case "gag": + return url.pathname.match(/gag\/([^/]+)/)?.[1]; + case "twitch": + if (/^m\.twitch\.tv$/.test(window.location.hostname)) { + const linkUrl = document.head.querySelector('link[rel="canonical"]'); + return ( + linkUrl?.href.match(/videos\/([^/]+)/)?.[0] || url.pathname.slice(1) + ); + } else if (/^player\.twitch\.tv$/.test(window.location.hostname)) { + return `videos/${url.searchParams.get("video")}`; + } else if (/^clips\.twitch\.tv$/.test(window.location.hostname)) { + // get link to twitch channel (ex.: https://www.twitch.tv/xqc) + const channelLink = document.querySelector( + ".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']" + ); + if (!channelLink) { + return false; + } + + const channelName = channelLink.href.replace( + "https://www.twitch.tv/", + "" + ); + return `${channelName}/clip/${url.searchParams.get("clip")}`; + } else if (url.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)) { + return url.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]; + } else { + return url.pathname.match(/(?:videos)\/([^/]+)/)?.[0]; + } + case "tiktok": + return url.pathname.match(/video\/([^/]+)/)?.[1]; + case "vimeo": + return ( + url.pathname.match(/[^/]+\/[^/]+$/)?.[0] || + url.pathname.match(/[^/]+$/)?.[0] + ); + case "xvideos": + return url.pathname.match(/[^/]+\/[^/]+$/)?.[0]; + case "pornhub": + return ( + url.searchParams.get("viewkey") || + url.pathname.match(/embed\/([^/]+)/)?.[1] + ); + case "twitter": + return url.pathname.match(/status\/([^/]+)/)?.[1]; + case "udemy": + return url.pathname; + case "facebook": + return url.pathname; + case "rutube": + return url.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1]; + case "coub": + return url.pathname.match(/view\/([^/]+)/)?.[1]; + case "bilibili.com": + const bvid = url.searchParams.get("bvid"); + if (bvid) { + return bvid; + } else { + let vid = url.pathname.match(/video\/([^/]+)/)?.[1]; + if (vid && url.search && url.searchParams.get("p") !== null) { + vid += `/?p=${url.searchParams.get("p")}`; + } + return vid; + } + case "mail.ru": + if (url.pathname.startsWith("/v/") || url.pathname.startsWith("/mail/")) { + return url.pathname; + } else if (url.pathname.match(/video\/embed\/([^/]+)/)) { + const referer = document.querySelector( + ".b-video-controls__mymail-link" + ); + if (!referer) { + return false; + } + + return referer?.href.split("my.mail.ru")?.[1]; + } + default: + return false; + } +}; + +function secsToStrTime(secs) { + const minutes = Math.floor(secs / 60); + const seconds = Math.floor(secs % 60); + if (minutes >= 60) { + return constants/* translations */.Iz[lang].translationTakeMoreThanHour; + } else if (minutes >= 10 && minutes % 10) { + return constants/* translations */.Iz[lang].translationTakeApproximatelyMinutes.format( + minutes + ); + } else if (minutes == 1 || (minutes == 0 && seconds > 0)) { + return constants/* translations */.Iz[lang].translationTakeAboutMinute; + } else { + return constants/* translations */.Iz[lang].translationTakeApproximatelyMinute.format( + minutes + ); + } +} + + + +// EXTERNAL MODULE: ./src/config/config.js +var config = __webpack_require__("./src/config/config.js"); +;// CONCATENATED MODULE: ./src/config/alternativeUrls.js +// Sites host Invidious. I tested the performance only on invidious.kevin.rocks, youtu.be and inv.vern.cc +const sitesInvidious = [ + "invidious.snopyta.org", + "yewtu.be", + "invidious.kavin.rocks", + "vid.puffyan.us", + "invidious.namazso.eu", + "inv.riverside.rocks", + "yt.artemislena.eu", + "invidious.flokinet.to", + "invidious.esmailelbob.xyz", + "y.com.sb", + "invidious.nerdvpn.de", + "inv.vern.cc", + "invidious.slipfox.xyz", + "invidio.xamh.de", + "invidious.dhusch.de", +]; + +// Sites host Piped. I tested the performance only on piped.video +const sitesPiped = [ + "piped.video", + "piped.tokhmi.xyz", + "piped.moomoo.me", + "piped.syncpundit.io", + "piped.mha.fi", + "watch.whatever.social", + "piped.garudalinux.org", + "efy.piped.pages.dev", + "watch.leptons.xyz", + "piped.lunar.icu", + "yt.dc09.ru", + "piped.mint.lgbt", + "il.ax", + "piped.privacy.com.de", + "piped.esmailelbob.xyz", + "piped.projectsegfau.lt", + "piped.in.projectsegfau.lt", + "piped.us.projectsegfau.lt", + "piped.privacydev.net", + "piped.palveluntarjoaja.eu", + "piped.smnz.de", + "piped.adminforge.de", + "piped.qdi.fi", + "piped.hostux.net", + "piped.chauvet.pro", + "piped.jotoma.de", + "piped.pfcd.me", + "piped.frontendfriendly.xyz", +]; + + + +;// CONCATENATED MODULE: ./src/indexedDB.js + + + +// --- IndexedDB functions start: +const dbVersion = 2; // current db version +const settingsDefault = { + key: "settings", + autoTranslate: 0, + defaultVolume: 100, + showVideoSlider: 0, + syncVolume: 0, + autoSetVolumeYandexStyle: 1, + dontTranslateYourLang: 1, +}; // default settings for db v1 + +const valuesV2 = { + audioProxy: 0, +}; + +function openDB(name) { + return indexedDB.open(name, dbVersion); +} + +async function initDB() { + return new Promise((resolve, reject) => { + function updateVersionProccessor( + transaction, + db, + indexes, + previousIndexes = {} + ) { + // openRequest is transaction object + // indexes is object of strings with default values (used for createIndex) ex. {"name": 0} + // previousIndexes is indexes for previous version + const objectStore = transaction.objectStore("settings"); + + for (const key of Object.keys(indexes)) { + objectStore.createIndex(key, key, { unique: false }); + } + + console.log("VOT: The database has been updated"); + objectStore.transaction.oncomplete = (event) => { + const objectStore = db + .transaction("settings", "readwrite") + .objectStore("settings"); + const request = objectStore.get("settings"); + + request.onerror = (event) => { + console.error( + "VOT: Data could not be retrieved from the Database: ", + event.error + ); + reject(false); + }; + + request.onsuccess = () => { + const data = + request.result || Object.assign(settingsDefault, previousIndexes); // use data from db or reset all data + for (const key in indexes) { + data[key] = indexes[key]; + } + + const requestUpdate = objectStore.put(data); + + requestUpdate.onerror = (event) => { + console.error( + "VOT: Failed to update the Database to new version", + event.error + ); + reject(false); + }; + + requestUpdate.onsuccess = () => { + console.log( + "VOT: Standard settings of the new version have been added to the Database." + ); + resolve(true); + }; + }; + }; + } + + const openRequest = openDB("VOT"); + + openRequest.onerror = () => { + console.error( + `${constants/* translations */.Iz[lang].VOTFailedInitDB}: ${openRequest.error.message}` + ); + reject(false); + }; + + openRequest.onupgradeneeded = (event) => { + const db = openRequest.result; + + db.onerror = () => { + const errorMessage = constants/* translations */.Iz[lang].VOTFailedInitDB; + alert(errorMessage); + console.error(errorMessage, openRequest.error); + reject(false); + }; + + if (event.oldVersion < 1) { + // db not found + const objectStore = db.createObjectStore("settings", { + keyPath: "key", + }); + + // add indexes for 1 version (without key index) + for (const key of Object.keys(settingsDefault).filter( + (k) => k !== "key" + )) { + objectStore.createIndex(key, key, { unique: false }); + } + + console.log("VOT: Database Created"); + + objectStore.transaction.oncomplete = (event) => { + const objectStore = db + .transaction("settings", "readwrite") + .objectStore("settings"); + const request = objectStore.add(settingsDefault); + + request.onsuccess = () => { + console.log( + "VOT: Standard settings added to the Database: ", + request.result + ); + resolve(true); + }; + + request.onerror = () => { + console.log( + "VOT: Error when adding standard settings to the Database: ", + request.error + ); + reject(false); + }; + }; + } + + if (event.oldVersion < 2) { + // db is outdated (db version is 1) + updateVersionProccessor(openRequest.transaction, db, valuesV2); + } + }; + + openRequest.onsuccess = () => { + const db = openRequest.result; + db.onversionchange = () => { + db.close(); + const errorMessage = constants/* translations */.Iz[lang].VOTDBNeedUpdate; + alert(errorMessage); + console.log(errorMessage); + window.location.reload(); + reject(false); + }; + resolve(true); + }; + + openRequest.onblocked = () => { + const db = openRequest.result; + const errorMessage = constants/* translations */.Iz[lang].VOTDisabledForDBUpdating; + console.error(errorMessage, db); + alert(errorMessage); + reject(false); + }; + }); +} + +async function updateDB({ + autoTranslate, + defaultVolume, + showVideoSlider, + syncVolume, + autoSetVolumeYandexStyle, + dontTranslateYourLang, + audioProxy, +}) { + return new Promise((resolve, reject) => { + if ( + typeof autoTranslate === "number" || + typeof defaultVolume === "number" || + typeof showVideoSlider === "number" || + typeof syncVolume === "number" || + typeof autoSetVolumeYandexStyle === "number" || + typeof dontTranslateYourLang === "number" || + typeof audioProxy === "number" + ) { + const openRequest = openDB("VOT"); + + openRequest.onerror = () => { + const errorMessage = constants/* translations */.Iz[lang].VOTFailedWriteToDB; + alert(errorMessage); + console.error(errorMessage, openRequest.error.message); + reject(false); + }; + + openRequest.onupgradeneeded = async () => { + const db = openRequest.result; + db.close(); + await initDB(); + resolve(true); + }; + + openRequest.onsuccess = () => { + const db = openRequest.result; + db.onversionchange = () => { + db.close(); + console.log( + "VOT: The database needs an update, please reload the page if it didn't happen automatically" + ); + window.location.reload(); + reject(false); + }; + + const objectStore = db + .transaction("settings", "readwrite") + .objectStore("settings"); + const request = objectStore.get("settings"); + + request.onerror = (event) => { + console.error( + "VOT: Data could not be retrieved from the Database: ", + event.error + ); + reject(false); + }; + + request.onsuccess = () => { + const data = request.result; + + if (typeof autoTranslate === "number") { + data.autoTranslate = autoTranslate; + } + + if (typeof defaultVolume === "number") { + data.defaultVolume = defaultVolume; + } + + if (typeof showVideoSlider === "number") { + data.showVideoSlider = showVideoSlider; + } + + if (typeof syncVolume === "number") { + data.syncVolume = syncVolume; + } + + if (typeof autoSetVolumeYandexStyle === "number") { + data.autoSetVolumeYandexStyle = autoSetVolumeYandexStyle; + } + + if (typeof dontTranslateYourLang === "number") { + data.dontTranslateYourLang = dontTranslateYourLang; + } + + if (typeof audioProxy === "number") { + data.audioProxy = audioProxy; + } + + const requestUpdate = objectStore.put(data); + + requestUpdate.onerror = (event) => { + console.error( + "VOT: Не удалось обновить данные в Базе Данных: ", + event.error + ); + reject(false); + }; + + requestUpdate.onsuccess = () => { + resolve(true); + }; + }; + }; + + openRequest.onblocked = () => { + const db = openRequest.result; + const errorMessage = constants/* translations */.Iz[lang].VOTDisabledForDBUpdating; + console.error(errorMessage, db); + alert(errorMessage); + reject(false); + }; + } + }); +} + +async function readDB() { + return new Promise((resolve, reject) => { + const openRequest = openDB("VOT"); + + openRequest.onerror = () => { + const errorMessage = constants/* translations */.Iz[lang].VOTFailedReadFromDB; + alert(errorMessage); + console.error(errorMessage, openRequest.error.message); + reject(false); + }; + + openRequest.onupgradeneeded = async () => { + const db = openRequest.result; + db.close(); + await initDB(); + resolve(true); + }; + + openRequest.onsuccess = () => { + const db = openRequest.result; + db.onversionchange = () => { + db.close(); + const errorMessage = constants/* translations */.Iz[lang].VOTDBNeedUpdate; + alert(errorMessage); + console.error(errorMessage); + reject(false); + }; + + const objectStore = db.transaction("settings").objectStore("settings"); + const request = objectStore.get("settings"); + + request.onerror = (event) => { + console.error(constants/* translations */.Iz[lang].VOTFailedReadFromDB, event.error); + console.error(event); + reject(false); + }; + + request.onsuccess = () => { + if (request.result === undefined) { + db.close(); + deleteDB(); + reject(false); + } + const data = request.result; + resolve(data); + }; + }; + + openRequest.onblocked = () => { + const db = openRequest.result; + const errorMessage = constants/* translations */.Iz[lang].VOTDisabledForDBUpdating; + console.error(errorMessage, db); + alert(errorMessage); + reject(false); + }; + }); +} + +function deleteDB() { + indexedDB.deleteDatabase("VOT"); +} + + + +;// CONCATENATED MODULE: ./src/utils/volume.js +// element - audio / video element +function syncVolume(element, sliderVolume, otherSliderVolume, tempVolume) { + let finalValue; + if (sliderVolume > tempVolume) { + // sliderVolume = 100 + // tempVolume = 69 + // volume = 15 + // 100 - 69 = 31 + // 15 + 31 = 46 - final video volume + finalValue = otherSliderVolume + (sliderVolume - tempVolume); + finalValue = finalValue > 100 ? 100 : Math.max(finalValue, 0); + + element.volume = finalValue / 100; + } else if (sliderVolume < tempVolume) { + // sliderVolume = 69 + // tempVolume = 100 + // volume = 15 + // 100 - 69 = 31 + // 15 - 31 = 0 - final video volume + finalValue = otherSliderVolume - (tempVolume - sliderVolume); + finalValue = finalValue > 100 ? 100 : Math.max(finalValue, 0); + + element.volume = finalValue / 100; + } + + return finalValue; +} + + + +// EXTERNAL MODULE: ./src/config/config-cloudflare.js +var config_cloudflare = __webpack_require__("./src/config/config-cloudflare.js"); +;// CONCATENATED MODULE: ./src/config/regexes.js +const regexes = () => { + return { + youtubeRegex: /^(www.|m.)?youtube(-nocookie)?.com$/, + }; +}; + +/* harmony default export */ const config_regexes = (regexes()); + +;// CONCATENATED MODULE: ./src/config/selectors.js +const selectors = () => { + return { + youtubeSelector: ".html5-video-container", + twitchSelector: ".video-ref", + twitchMobileSelector: "main > div > section > div > div > div", + pipedSelector: ".shaka-video-container", + vkSelector: ".videoplayer_media", + twitterSelector: + 'div[data-testid="videoComponent"] > div:nth-child(1) > div', + vimeoSelector: ".player", + gagSelector: ".video-post", + bilibilicomSelector: ".bpx-player-video-wrap", + mailSelector: "#b-video-wrapper", + }; +}; + +/* harmony default export */ const config_selectors = (selectors()); + +;// CONCATENATED MODULE: ./src/index.js + + + + + + + + + + + + + + + +const sitesChromiumBlocked = [...sitesInvidious, ...sitesPiped]; + +// translate properties +let translateFromLang = "en"; // default language of video + +let translateToLang = "ru"; // default language of audio response + +let ytData = ""; + +async function src_main() { + debug/* default */.Z.log("Loading extension..."); + debug/* default */.Z.log(`Selected menu language: ${lang}`); + // test all translations in console + // debug.translations('ru'); + // debug.translations('en'); + // debug.translations('de'); + // debug.translations('zh'); + // debug.translations('es'); + // debug.translations('fr'); + // debug.translations('it'); + + const rvt = await Promise.resolve(/* import() */).then(__webpack_require__.bind(__webpack_require__, "./src/rvt-cloudflare.js")); + + const requestVideoTranslation = rvt.default; + + debug/* default */.Z.log("Inited requestVideoTranslation..."); + + if ( + false + ) {} + + debug/* default */.Z.log("Extension compatibility passed..."); + + let timer; + const audio = new Audio(); + let opacityRatio = 0.9; + let openedMenu = false; + + if (true) { + var translationPanding = false; + } + + function logout(n) { + if (openedMenu) return; + + document.querySelector(".translationBlock").style.opacity = n; + } + + function resetTimer() { + clearTimeout(timer); + logout(1); + timer = setTimeout(() => { + logout(0); + }, 2000); + } + + function changeOpacityOnEvent(event, timer, opacityRatio) { + clearTimeout(timer); + logout(opacityRatio); + event.stopPropagation(); + } + + const deleteAudioSrc = () => { + audio.src = ""; + audio.removeAttribute("src"); + }; + + // Add menu container + function addTranslationMenu(element) { + if (element.querySelector(".translationMenuContent")) return; + + const container = createTranslationMenu(); + element.appendChild(container); + + // click to translation menu icon + document + .querySelector(".translationMenu") + ?.addEventListener("click", (event) => { + event.stopPropagation(); + const content = document.querySelector(".translationMenuContent"); + content.style.display = openedMenu ? "none" : "block"; + content.style.opacity = opacityRatio; + openedMenu = !openedMenu; + }); + + document + .querySelector(".translationDropDB") + .addEventListener("click", (event) => { + event.stopPropagation(); + deleteDB(); + location.reload(); + }); + + debug/* default */.Z.log("VOT: Added translation menu to ", element); + } + + function translateVideo(url, unknown1, requestLang, responseLang, callback) { + debug/* default */.Z.log( + `Translate video (url: ${url}, unknown1: ${unknown1}, requestLang: ${requestLang}, responseLang: ${responseLang})` + ); + + if ( true && translationPanding) { + debug/* default */.Z.log("translationPanding return"); + return; + } + + translationPanding = true; + + requestVideoTranslation( + url, + unknown1, + requestLang, + responseLang, + (success, response) => { + translationPanding = false; + + debug/* default */.Z.log("[exec callback] Requesting video translation"); + if (!success) { + callback(false, constants/* translations */.Iz[lang].requestTranslationFailed); + return; + } + + const translateResponse = yandexRequests/* yandexRequests */.G.decodeResponse(response); + console.log("VOT Response: ", translateResponse); + + switch (translateResponse.status) { + case 0: + callback(false, translateResponse.message); + break; + case 1: + callback( + !!translateResponse.url, + translateResponse.url || constants/* translations */.Iz[lang].audioNotReceived + ); + break; + case 2: + callback( + false, + translateResponse.remainingTime + ? secsToStrTime(translateResponse.remainingTime) + : constants/* translations */.Iz[lang].translationTakeFewMinutes + ); + break; + case 3: + /* + Иногда, в ответе приходит статус код 3, но видео всё, так же, ожидает перевода. В конечном итоге, это занимает слишком много времени, + как-будто сервер не понимает, что данное видео уже недавно было переведено и заместо возвращения готовой ссылки на перевод начинает переводить видео заново при чём у него это получается за очень длительное время + */ + callback(false, constants/* translations */.Iz[lang].videoBeingTranslated); + break; + } + } + ); + } + + async function translateProccessor(videoContainer, siteHostname, siteEvent) { + debug/* default */.Z.log("[translateProccessor] execute on element: ", videoContainer); + + let video; + let autoRetry; + let volumeOnStart; + let tempOriginalVolume; + let tempVolume; + let dbAutoTranslate; + let dbDefaultVolume; + let dbShowVideoSlider; + let dbAutoSetVolumeYandexStyle; + let dontTranslateYourLang; + let dbSyncVolume; + let dbAudioProxy; // cf version only + let firstPlay = true; + let isDBInited; + + debug/* default */.Z.log("videoContainer", videoContainer); + + video = + siteHostname === "vimeo" + ? videoContainer.querySelector( + ".vp-video-wrapper > .vp-video > .vp-telecine > video" + ) + : videoContainer.querySelector("video"); + + debug/* default */.Z.log("video", video); + + let videoData = await getVideoData(); + console.log("VOT Video Data: ", videoData); + + const container = + siteHostname === "pornhub" && + window.location.pathname.includes("view_video.php") + ? document.querySelector(".original.mainPlayerDiv") + : siteHostname === "pornhub" && + window.location.pathname.includes("embed/") + ? document.querySelector("body") + : window.location.hostname.includes("m.youtube.com") + ? document.querySelector("#player-control-container") + : videoContainer; + + addTranslationBlock(container); + addTranslationMenu(container); + + try { + isDBInited = await initDB(); + } catch (err) { + console.error( + "[VOT] Failed to initialize database settings. All changes made will not be saved", + err + ); + } + + const menuOptions = document.querySelector(".translationMenuOptions"); + if (menuOptions && !menuOptions.querySelector("#VOTTranslateFromLang")) { + const selectFromLangOptions = [ + { + label: constants/* translations */.Iz[lang].videoLanguage, + value: "default", + disabled: true, + }, + ...Object.entries(constants/* availableLangs */.tW).map(([key, value]) => ({ + label: constants/* translations */.Iz[lang][value], + value: key, + selected: videoData.detectedLanguage === key, + })), + ]; + + const selectToLangOptions = [ + { + label: constants/* translations */.Iz[lang].translationLanguage, + value: "default", + disabled: true, + }, + ...Object.entries(constants/* availableLangs */.tW).map(([key, value]) => ({ + label: constants/* translations */.Iz[lang][value], + value: key, + selected: videoData.responseLanguage === key, + })), + ]; + + const selectFromLang = createMenuSelect( + "VOTTranslateFromLang", + selectFromLangOptions + ); + + const selectToLang = createMenuSelect( + "VOTTranslateToLang", + selectToLangOptions + ).firstElementChild; + + selectFromLang.id = "VOTSelectLanguages"; + selectFromLang.innerHTML += ` + + + + `; + + selectFromLang.appendChild(selectToLang); + menuOptions.appendChild(selectFromLang); + + menuOptions + .querySelector("#VOTTranslateFromLang") + .addEventListener("change", async (event) => { + debug/* default */.Z.log("[onchange] select from language", event.target.value); + videoData = await setDetectedLangauge(videoData, event.target.value); + }); + + menuOptions + .querySelector("#VOTTranslateToLang") + .addEventListener("change", async (event) => { + debug/* default */.Z.log("[onchange] select to language", event.target.value); + videoData = await setResponseLangauge(videoData, event.target.value); + }); + } + + if (isDBInited) { + const dbData = await readDB(); + if (dbData) { + dbAutoTranslate = dbData.autoTranslate; + dbDefaultVolume = dbData.defaultVolume; + dbShowVideoSlider = dbData.showVideoSlider; + dbAutoSetVolumeYandexStyle = dbData.autoSetVolumeYandexStyle; + dontTranslateYourLang = dbData.dontTranslateYourLang; + dbAudioProxy = dbData.audioProxy; // cf version only + dbSyncVolume = dbData.syncVolume; // youtube only + + debug/* default */.Z.log("[db] data from db: ", dbData); + + if ( + dbAutoTranslate !== undefined && + menuOptions && + !menuOptions.querySelector("#VOTAutoTranslate") + ) { + const checkbox = createMenuCheckbox( + "VOTAutoTranslate", + dbAutoTranslate, + constants/* translations */.Iz[lang].VOTAutoTranslate + + (siteHostname === "vk" || + window.location.hostname.includes("m.twitch.tv") + ? ` (${constants/* translations */.Iz[lang].recommended})` + : "") + ); + + checkbox.querySelector("#VOTAutoTranslate").onclick = async ( + event + ) => { + event.stopPropagation(); + const value = Number(event.target.checked); + await updateDB({ autoTranslate: value }); + dbAutoTranslate = value; + debug/* default */.Z.log( + "autoTranslate value changed. New value: ", + dbAutoTranslate + ); + }; + + menuOptions.appendChild(checkbox); + } + + if ( + window.location.hostname.includes("youtube.com") && + dontTranslateYourLang !== undefined && + menuOptions && + !menuOptions.querySelector("#VOTDontTranslateYourLang") + ) { + const checkbox = createMenuCheckbox( + "VOTDontTranslateYourLang", + dontTranslateYourLang, + constants/* translations */.Iz[lang].VOTDontTranslateYourLang + ); + + checkbox.querySelector("#VOTDontTranslateYourLang").onclick = async ( + event + ) => { + event.stopPropagation(); + const value = Number(event.target.checked); + await updateDB({ dontTranslateYourLang: value }); + dontTranslateYourLang = value; + debug/* default */.Z.log( + "dontTranslateYourLang value changed. New value: ", + dontTranslateYourLang + ); + }; + + menuOptions.appendChild(checkbox); + } + + if ( + dbAutoSetVolumeYandexStyle !== undefined && + menuOptions && + !menuOptions.querySelector("#VOTAutoSetVolume") + ) { + const checkbox = createMenuCheckbox( + "VOTAutoSetVolume", + dbAutoSetVolumeYandexStyle, + constants/* translations */.Iz[lang].VOTAutoSetVolume + `${config/* autoVolume */.IM * 100}%` + ); + + checkbox.querySelector("#VOTAutoSetVolume").onclick = async ( + event + ) => { + event.stopPropagation(); + const value = Number(event.target.checked); + await updateDB({ autoSetVolumeYandexStyle: value }); + dbAutoSetVolumeYandexStyle = value; + debug/* default */.Z.log( + "autoSetVolumeYandexStyle value changed. New value: ", + dbAutoSetVolumeYandexStyle + ); + }; + + menuOptions.appendChild(checkbox); + } + + if ( + dbShowVideoSlider !== undefined && + menuOptions && + !menuOptions.querySelector("#VOTShowVideoSlider") + ) { + const checkbox = createMenuCheckbox( + "VOTShowVideoSlider", + dbShowVideoSlider, + constants/* translations */.Iz[lang].VOTShowVideoSlider + ); + + checkbox.querySelector("#VOTShowVideoSlider").onclick = async ( + event + ) => { + event.stopPropagation(); + const value = Number(event.target.checked); + await updateDB({ showVideoSlider: value }); + dbShowVideoSlider = value; + debug/* default */.Z.log( + "showVideoSlider value changed. New value: ", + dbShowVideoSlider + ); + if ( + dbShowVideoSlider === 1 && + document.querySelector(".translationBtn").dataset.state === + "success" + ) { + addVideoSlider(); + } else { + document.querySelector("#VOTVideoSlider")?.parentElement.remove(); + } + }; + + menuOptions.appendChild(checkbox); + } + + if ( + window.location.hostname.includes("youtube.com") && + !window.location.hostname.includes("m.youtube.com") && + dbSyncVolume !== undefined && + menuOptions && + !menuOptions.querySelector("#VOTSyncVolume") + ) { + const checkbox = createMenuCheckbox( + "VOTSyncVolume", + dbSyncVolume, + constants/* translations */.Iz[lang].VOTSyncVolume + ); + + checkbox.querySelector("#VOTSyncVolume").onclick = async (event) => { + event.stopPropagation(); + const value = Number(event.target.checked); + await updateDB({ syncVolume: value }); + dbSyncVolume = value; + debug/* default */.Z.log("syncVolume value changed. New value: ", dbSyncVolume); + }; + + menuOptions.appendChild(checkbox); + } + + // cf version only + if ( + true && + dbAudioProxy !== undefined && + menuOptions && + !menuOptions.querySelector("#VOTAudioProxy") + ) { + const checkbox = createMenuCheckbox( + "VOTAudioProxy", + dbAudioProxy, + constants/* translations */.Iz[lang].VOTAudioProxy + ); + + checkbox.querySelector("#VOTAudioProxy").onclick = async (event) => { + event.stopPropagation(); + const value = Number(event.target.checked); + await updateDB({ audioProxy: value }); + dbAudioProxy = value; + debug/* default */.Z.log("audioProxy value changed. New value: ", dbAudioProxy); + }; + + menuOptions.appendChild(checkbox); + } + } + } + + transformBtn("none", constants/* translations */.Iz[lang].translateVideo); + + if ( + window.location.hostname.includes("youtube.com") && + !window.location.hostname.includes("m.youtube.com") + ) { + const syncVolumeObserver = new MutationObserver(async function ( + mutations + ) { + mutations.forEach(async function (mutation) { + if ( + mutation.type === "attributes" && + mutation.attributeName === "aria-valuenow" && + document.querySelector("#VOTVideoSlider") + ) { + syncVideoVolumeSlider(); + } + }); + }); + + syncVolumeObserver.observe(document.querySelector(".ytp-volume-panel"), { + attributes: true, + childList: false, + subtree: true, + attributeOldValue: true, + }); + } + + function setSelectMenuValues(from, to = lang) { + if (!document.querySelector("#VOTSelectLanguages")) { + return; + } + console.log(`Set translation from ${from} to ${to}`); + document.querySelector("#VOTTranslateFromLang").value = from; + document.querySelector("#VOTTranslateToLang").value = to; + } + + // data - ytData or VideoData + async function setDetectedLangauge(data, videolang) { + switch (videolang) { + case "en": + data.detectedLanguage = videolang; + data.responseLanguage = lang; + break; + case "ru": + data.detectedLanguage = videolang; + data.responseLanguage = lang; + if (lang == "ru") data.responseLanguage = "en"; + break; + default: + if (!Object.keys(constants/* availableLangs */.tW).includes(videolang)) { + return setDetectedLangauge(data, "en"); + } + + data.detectedLanguage = videolang; + } + + setSelectMenuValues(data.detectedLanguage, data.responseLanguage); + + return data; + } + + // data - ytData or VideoData + async function setResponseLangauge(data, videolang) { + switch (videolang) { + case "en": + data.responseLanguage = videolang; + data.detectedLanguage = "ru"; + break; + default: + if (!Object.keys(constants/* availableLangs */.tW).includes(videolang)) { + return setResponseLangauge(data, "ru"); + } + + if (data.detectedLanguage && data.responseLanguage === lang) { + data.detectedLanguage = "en"; + } + + data.responseLanguage = videolang; + } + + setSelectMenuValues(data.detectedLanguage, data.responseLanguage); + + return data; + } + + function stopTraslate() { + // Default actions on stop translate + audio.pause(); + video.removeEventListener(".translate", stopTraslate, false); + deleteAudioSrc(); + document.querySelector("#VOTVideoSlider")?.parentElement.remove(); + document.querySelector("#VOTTranslationSlider")?.parentElement.remove(); + const downloadBtn = document.querySelector(".translationDownload"); + downloadBtn.href = ""; + downloadBtn.style.display = "none"; + transformBtn("none", constants/* translations */.Iz[lang].translateVideo); + if (volumeOnStart) { + video.volume = volumeOnStart; + } + } + + function syncVideoVolumeSlider() { + // Sync volume slider with original video (youtube only) + const newSlidersVolume = document + .querySelector(".ytp-volume-panel") + .getAttribute("aria-valuenow"); + + const videoSlider = document.querySelector("#VOTVideoSlider"); + + if (!videoSlider) { + return; + } + videoSlider.value = newSlidersVolume; + + const videoVolumeLabel = document.querySelector("#VOTVideoVolume"); + + if (videoVolumeLabel) { + videoVolumeLabel.innerText = `${newSlidersVolume}%`; + } + + if (dbSyncVolume === 1) { + tempOriginalVolume = Number(newSlidersVolume); + } + } + + async function getVideoData() { + const videoData = {}; + + videoData.duration = video?.duration || 0; + + videoData.videoId = getVideoId(siteHostname); + + videoData.detectedLanguage = translateFromLang; + + videoData.responseLanguage = translateToLang; + + if (window.location.hostname.includes("youtube.com")) { + ytData = await getYTVideoData(); + ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); + videoData.detectedLanguage = ytData.detectedLanguage; + videoData.responseLanguage = ytData.responseLanguage; + } else if ( + window.location.hostname.includes("rutube") || + window.location.hostname.includes("my.mail.ru") + ) { + videoData.detectedLanguage = "ru"; + videoData.responseLanguage = "en"; + } else if (window.location.hostname.includes("bilibili.com")) { + videoData.detectedLanguage = "zh"; + } + + return videoData; + } + + const lipSync = (mode = false) => { + debug/* default */.Z.log("lipsync video", video); + if (!video) { + return; + } + audio.currentTime = video.currentTime; + audio.playbackRate = video.playbackRate; + + if (!mode) { + debug/* default */.Z.log("lipsync mode is not set"); + return; + } + + if (mode === "play") { + debug/* default */.Z.log("lipsync mode is play"); + const audioPromise = audio.play(); + if (audioPromise !== undefined) { + audioPromise.catch((e) => { + console.error(e); + if (e.name === "NotAllowedError") { + const errorMessage = constants/* translations */.Iz[lang].grantPermissionToAutoPlay; + transformBtn("error", errorMessage); + throw `VOT: ${errorMessage}`; + } else if (e.name === "NotSupportedError") { + const errorMessage = sitesChromiumBlocked.includes( + window.location.hostname + ) + ? constants/* translations */.Iz[lang].neededAdditionalExtension + : constants/* translations */.Iz[lang].audioFormatNotSupported; + transformBtn("error", errorMessage); + throw `VOT: ${errorMessage}`; + } + }); + } + return; + } + if (mode === "pause" || "stop" || 0 || 0) { + debug/* default */.Z.log(`lipsync mode is ${mode}`); + audio.pause(); + } + if (mode === "playing") { + debug/* default */.Z.log("lipsync mode is playing"); + audio.play(); + } + }; + + function addVideoSlider() { + if ( + dbShowVideoSlider !== 1 || + document.querySelector("#VOTVideoSlider") || + document.querySelector(".translationBtn").dataset.state !== "success" + ) { + return; + } + + const newVolume = + window.location.hostname.includes("youtube.com") && + !dbAutoSetVolumeYandexStyle + ? document + .querySelector(".ytp-volume-panel") + ?.getAttribute("aria-valuenow") + : Math.round(video.volume * 100); + tempOriginalVolume = newVolume; + + const slider = createMenuSlider( + "VOTVideoSlider", + newVolume, + `${constants/* translations */.Iz[lang].VOTVolume}: ${newVolume}%` + ); + + slider.querySelector("#VOTVideoSlider").oninput = (event) => { + const { value } = event.target; + video.volume = value / 100; + slider.querySelector("#VOTOriginalVolume").innerText = `${value}%`; + + if (dbSyncVolume !== 1) { + return; + } + + // Sync translation volume slider with video volume slider + const translateVolumeSlider = document.querySelector( + "#VOTTranslationSlider" + ); + + if (!translateVolumeSlider) { + return; + } + const translateVolume = Number(translateVolumeSlider.value); + const finalValue = syncVolume( + audio, + value, + translateVolume, + tempOriginalVolume + ); + + translateVolumeSlider.value = finalValue; + + const translateVolumeLabel = document.querySelector( + "#VOTTranslationVolume" + ); + + if (translateVolumeLabel) { + translateVolumeLabel.innerText = `${finalValue}%`; + } + + tempVolume = finalValue; + tempOriginalVolume = value; + }; + + const menuOptions = document.querySelector(".translationMenuOptions"); + menuOptions.appendChild(slider); + } + + function addTranslationSlider() { + // Return early if slider already exists or translation is not successful + if ( + document.querySelector("#VOTTranslationSlider") || + document.querySelector(".translationBtn").dataset.state !== "success" + ) { + return; + } + + // Use dbDefaultVolume or 100 as the default translation volume + const defaultTranslateVolume = + typeof dbDefaultVolume === "number" ? dbDefaultVolume : 100; + tempOriginalVolume = defaultTranslateVolume; + + // Create a slider element with the default volume and label + const slider = createMenuSlider( + "VOTTranslationSlider", + defaultTranslateVolume, + `${constants/* translations */.Iz[lang].VOTVolumeTranslation}: ${defaultTranslateVolume}%` + ); + + // Add an input event listener to the slider + slider.querySelector("#VOTTranslationSlider").oninput = async ({ + target: { value }, + }) => { + // Set the audio volume to the slider value + audio.volume = value / 100; + + // Update the volume label + document.querySelector("#VOTTranslationVolume").innerText = `${value}%`; + + // Update the database with the new volume value + await updateDB({ defaultVolume: Number(value) }); + dbDefaultVolume = Number(value); + + // Sync translation volume with video volume if dbSyncVolume is 1 + if (dbSyncVolume === 1) { + syncTranslationWithVideo(value); + } + }; + + // Append the slider to the menu options + const menuOptions = document.querySelector(".translationMenuOptions"); + menuOptions.appendChild(slider); + } + + // A helper function to sync translation volume with video volume + function syncTranslationWithVideo(translationValue) { + // Get the video volume slider element + const videoVolumeSlider = document.querySelector("#VOTVideoSlider"); + + if (!videoVolumeSlider) { + return; + } + // Get the video volume value + const videoVolume = Number(videoVolumeSlider.value); + + // Calculate the synced video volume based on the translation volume + const finalValue = syncVolume( + video, + translationValue, + videoVolume, + tempVolume + ); + + // Set the video volume slider value to the synced value + videoVolumeSlider.value = finalValue; + + // Update the video volume label + const videoVolumeLabel = document.querySelector("#VOTOriginalVolume"); + if (videoVolumeLabel) videoVolumeLabel.innerText = `${finalValue}%`; + + // Update the temp variables for future syncing + tempOriginalVolume = finalValue; + tempVolume = translationValue; + } + + async function videoValidator() { + if (window.location.hostname.includes("youtube.com")) { + ytData = setDetectedLangauge(ytData, ytData.detectedLanguage); + debug/* default */.Z.log("VideoValidator videoData: ", videoData); + if (dontTranslateYourLang === 1 && ytData.detectedLanguage === lang) { + firstPlay = false; + throw constants/* translations */.Iz[lang].VOTDisableFromYourLang; + } + + if (ytData.isLive) { + throw constants/* translations */.Iz[lang].VOTLiveNotSupported; + } + + if (ytData.isPremiere) { + throw constants/* translations */.Iz[lang].VOTPremiere; + } + if (videoData.duration > 14_400) { + throw constants/* translations */.Iz[lang].VOTVideoIsTooLong; + } + } + return true; + } + + const translateExecutor = async (VIDEO_ID) => { + debug/* default */.Z.log("Run videoValidator"); + await videoValidator(); + debug/* default */.Z.log("Run translateFunc"); + await translateFunc( + VIDEO_ID, + videoData.detectedLanguage, + videoData.responseLanguage + ); + }; + + // Define a function to handle common events + function handleVideoEvent(event) { + debug/* default */.Z.log(`video ${event.type}`); + lipSync(event.type); + } + + // Define a function to stop translation and clean up + function stopTranslation() { + stopTraslate(); + syncVideoVolumeSlider(); + } + + // Define a function to translate a video and handle the callback + function translateFunc(VIDEO_ID, requestLang, responseLang) { + const videoURL = `${constants/* siteTranslates */.g$[siteHostname]}${VIDEO_ID}`; + translateVideo( + videoURL, + constants/* translateFuncParam */.ey, + requestLang, + responseLang, + async (success, urlOrError) => { + debug/* default */.Z.log("[exec callback] translateVideo"); + if (getVideoId(siteHostname) !== VIDEO_ID) return; + if (!success) { + transformBtn("error", urlOrError); + // if the error line contains information that the translation is being performed, then we wait + if (urlOrError.includes(constants/* translations */.Iz[lang].translationTake)) { + clearTimeout(autoRetry); + autoRetry = setTimeout( + () => translateFunc(VIDEO_ID, requestLang, responseLang), + 60_000 + ); + } + throw urlOrError; + } + + audio.src = urlOrError; + + // cf version only + if ( + true && + dbAudioProxy === 1 && + urlOrError.startsWith("https://") + ) { + const audioPath = urlOrError.replace( + "https://vtrans.s3-private.mds.yandex.net/tts/prod/", + "" + ); + const proxiedAudioUrl = `https://${config_cloudflare/* workerHost */.i}/video-translation/audio-proxy/${audioPath}`; + console.log(`VOT Audio proxied via ${proxiedAudioUrl}`); + audio.src = proxiedAudioUrl; + } + + volumeOnStart = video?.volume; + if (typeof dbDefaultVolume === "number") { + audio.volume = dbDefaultVolume / 100; + } + if ( + typeof dbAutoSetVolumeYandexStyle === "number" && + dbAutoSetVolumeYandexStyle + ) { + video.volume = config/* autoVolume */.IM; + } + + switch (siteHostname) { + case "twitter": + document + .querySelector('div[data-testid="app-bar-back"][role="button"]') + .addEventListener("click", stopTranslation); + break; + case "invidious": + case "piped": + break; + default: + if (siteEvent !== null) { + document.body.addEventListener(siteEvent, stopTranslation); + } + break; + } + + const siteHostnames = [ + "twitch", + "vimeo", + "facebook", + "rutube", + "twitter", + "bilibili.com", + "mail.ru", + ]; + for (let i = 0; i < siteHostnames.length; i++) { + if (siteHostname === siteHostnames[i]) { + const mutationObserver = new MutationObserver( + async (mutations) => { + mutations.forEach(async (mutation) => { + if ( + mutation.type === "attributes" && + mutation.attributeName === "src" && + mutation.target === video && + mutation.target.src !== "" + ) { + stopTranslation(); + firstPlay = true; + } + }); + } + ); + mutationObserver.observe(videoContainer, { + attributes: true, + childList: false, + subtree: true, + attributeOldValue: true, + }); + break; + } + } + + if (video && !video.paused) lipSync("play"); + const videos = document.querySelectorAll("video"); + const events = [ + "playing", + "ratechange", + "play", + "abort", + "waiting", + "pause", + ]; + videos.forEach((v) => + events.forEach((e) => v.addEventListener(e, handleVideoEvent)) + ); + transformBtn("success", constants/* translations */.Iz[lang].disableTranslate); + addVideoSlider(); + addTranslationSlider(); + + const VOTVideoSlider = document.querySelector("#VOTVideoSlider"); + if (VOTVideoSlider) VOTVideoSlider.value = config/* autoVolume */.IM * 100; + + const VOTOriginalVolume = + document.querySelector("#VOTOriginalVolume"); + if (VOTOriginalVolume) { + VOTOriginalVolume.innerText = `${config/* autoVolume */.IM * 100}%`; + } + + const downloadBtn = document.querySelector(".translationDownload"); + downloadBtn.href = urlOrError; + downloadBtn.style.display = "initial"; + } + ); + } + + document.addEventListener("click", (event) => { + const block = document.querySelector(".translationBlock"); + const menuContainer = document.querySelector(".translationMenuContent"); + const isBlock = + block || event.target === block ? block.contains(event.target) : false; + const isContent = + menuContainer || event.target === menuContainer + ? menuContainer.contains(event.target) + : false; + const isVideo = + videoContainer || event.target === videoContainer + ? videoContainer.contains(event.target) + : false; + + debug/* default */.Z.log(`[document click] ${isBlock} ${isContent} ${isVideo}`); + if (!(!isBlock && !isContent)) return; + if (!isVideo) logout(0); + + menuContainer.style.display = "none"; + openedMenu = false; + }); + + const addEventListeners = (element, events, handler) => { + events.forEach((event) => element.addEventListener(event, handler)); + }; + + if (siteHostname === "pornhub") { + if (window.location.pathname.includes("view_video.php")) { + const videoElement = document.querySelector( + ".original.mainPlayerDiv > video-element > div" + ); + addEventListeners(videoElement, ["mousemove", "mouseout"], resetTimer); + } else if (window.location.pathname.includes("embed/")) { + const playerElement = document.querySelector("#player"); + addEventListeners(playerElement, ["mousemove", "mouseout"], resetTimer); + } + } else if (siteHostname === "twitter") { + const videoPlayerElement = document.querySelector( + 'div[data-testid="videoPlayer"' + ); + addEventListeners( + videoPlayerElement, + ["mousemove", "mouseout"], + resetTimer + ); + } else { + addEventListeners(videoContainer, ["mousemove", "mouseout"], resetTimer); + } + + document + .querySelector(".translationBlock") + .addEventListener("mousemove", (event) => + changeOpacityOnEvent(event, timer, opacityRatio) + ); + document + .querySelector(".translationMenuContent") + .addEventListener("mousemove", (event) => + changeOpacityOnEvent(event, timer, opacityRatio) + ); + + document.addEventListener("touchstart", (event) => + changeOpacityOnEvent(event, timer, opacityRatio) + ); + document.addEventListener("touchmove", (event) => + changeOpacityOnEvent(event, timer, opacityRatio) + ); + document.addEventListener("touchend", (event) => + changeOpacityOnEvent(event, timer, opacityRatio) + ); + + document + .querySelector(".translationBtn") + .addEventListener("click", async (event) => { + debug/* default */.Z.log("[click translationBtn] before all functions & methods"); + event.stopPropagation(); + event.stopImmediatePropagation(); + + // check if the audio source is not empty + if (audio.src) { + debug/* default */.Z.log("[click translationBtn] audio.src is not empty"); + stopTraslate(); + return; + } + + try { + debug/* default */.Z.log("[click translationBtn] trying execute translation"); + const VIDEO_ID = getVideoId(siteHostname); + + if (!VIDEO_ID) { + throw constants/* translations */.Iz[lang].VOTNoVideoIDFound; + } + + await translateExecutor(VIDEO_ID); + } catch (err) { + transformBtn("error", String(err).substring(4, err.length)); + console.error(err); + } + }); + + video.addEventListener("progress", async (event) => { + event.stopPropagation(); + + if (!(firstPlay && dbAutoTranslate === 1)) { + return; + } + const VIDEO_ID = getVideoId(siteHostname); + + if (!VIDEO_ID) { + throw constants/* translations */.Iz[lang].VOTNoVideoIDFound; + } + + try { + await translateExecutor(VIDEO_ID); + firstPlay = false; + } catch (err) { + transformBtn("error", String(err).substring(4, err.length)); + firstPlay = false; + } + }); + } + + async function initWebsite() { + debug/* default */.Z.log("Runned initWebsite function"); + if (config_regexes.youtubeRegex.test(window.location.hostname)) { + if (window.location.pathname.includes("embed")) { + const videoContainer = document.querySelector(".html5-video-container"); + await translateProccessor(videoContainer, "youtube", null); + return; + } + + debug/* default */.Z.log("[initWebsite] Found a match with youtube hostname"); + const ytPageEnter = () => { + const videoContainer = document.querySelector( + config_selectors.youtubeSelector + ); + if (videoContainer) { + debug/* default */.Z.log("[exec] translateProccessor youtube on page enter"); + translateProccessor(videoContainer, "youtube", "yt-translate-stop"); + } else { + if (!ytplayer || !ytplayer.config) { + debug/* default */.Z.log("[exec] ytplayer is null"); + return; + } + ytplayer.config.args.jsapicallback = () => { + debug/* default */.Z.log( + "[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)" + ); + translateProccessor(videoContainer, "youtube", "yt-translate-stop"); + }; + } + }; + + document.addEventListener("spfdone", ytPageEnter); + document.addEventListener("yt-navigate-finish", ytPageEnter); + + const ytPageLeave = () => { + document.body.dispatchEvent(new Event("yt-translate-stop")); + }; + + document.addEventListener("spfrequest", ytPageLeave); + document.addEventListener("yt-navigate-start", ytPageLeave); + + if (window.location.hostname.includes("m.youtube.com")) { + let ytmobile = await waitForElm("#player"); + if (ytmobile) { + await sleep(1000); + await translateProccessor(ytmobile, "youtube", "yt-translate-stop"); + + const mutationObserver = new MutationObserver(async (mutations) => { + for (const mutation of mutations) { + if ( + mutation.type === "attributes" && + mutation.attributeName === "src" + ) { + ytmobile = await waitForElm("#player"); + await sleep(1000); + await translateProccessor( + ytmobile, + "youtube", + "yt-translate-stop" + ); + } + } + }); + + mutationObserver.observe(ytmobile, { + attributes: true, + childList: true, + subtree: true, + attributeOldValue: true, + }); + } + const ytPageLeave = () => { + document.body.dispatchEvent(new Event("yt-translate-stop")); + }; + document.addEventListener("spfdone", ytPageLeave); + document.addEventListener("yt-navigate-finish", ytPageLeave); + document.addEventListener("spfrequest", ytPageLeave); + document.addEventListener("yt-navigate-start", ytPageLeave); + } + return; + } + if (window.location.hostname.includes("twitch.tv")) { + debug/* default */.Z.log("[initWebsite] Found a match with twitch.tv"); + if ( + window.location.hostname.includes("m.twitch.tv") && + (window.location.pathname.includes("/videos/") || + window.location.pathname.includes("/clip/")) + ) { + debug/* default */.Z.log("[initWebsite] Matched Twitch Mobile"); + const el = await waitForElm(config_selectors.twitchMobileSelector); + if (el) { + await sleep(200); + const twitchMobileSelector = document.querySelector( + config_selectors.twitchMobileSelector + ); + await translateProccessor(twitchMobileSelector, "twitch", null); + + const mutationObserver = new MutationObserver(async (mutations) => { + for (const mutation of mutations) { + if ( + mutation.type === "attributes" && + mutation.attributeName === "src" && + mutation.target === twitchMobileSelector?.querySelector("video") + ) { + await sleep(1000); + await translateProccessor(twitchMobileSelector, "twitch", null); + } + } + }); + + mutationObserver.observe(twitchMobileSelector, { + attributes: true, + childList: true, + subtree: true, + attributeOldValue: true, + }); + } + } else if ( + window.location.hostname.includes("player.twitch.tv") || + window.location.hostname.includes("clips.twitch.tv") || + window.location.pathname.includes("/videos/") || + window.location.pathname.includes("/clip/") + ) { + debug/* default */.Z.log("[initWebsite] Matched Twitch Desktop"); + const el = await waitForElm(config_selectors.twitchSelector); + if (el) { + await sleep(200); + await translateProccessor(el, "twitch", null); + } + } + debug/* default */.Z.log("[initWebsite] Exit function in the twitch section"); + return; + } + if (window.location.hostname.includes("xvideos.com")) { + debug/* default */.Z.log("[entered] xvideos"); + await sleep(1000); + await translateProccessor( + document.querySelector(".video-bg-pic"), + "xvideos", + null + ); + return; + } + if (window.location.hostname.includes("pornhub.com")) { + debug/* default */.Z.log("[entered] pornhub"); + await sleep(1000); + await translateProccessor( + document.querySelector(".mgp_videoWrapper"), + "pornhub", + null + ); + return; + } + if (sitesInvidious.includes(window.location.hostname)) { + // Need an additional extension to work in chrome-like browsers + debug/* default */.Z.log("[entered] invidious"); + await translateProccessor( + document.querySelector("#player"), + "youtube", + null + ); + } else if (sitesPiped.includes(window.location.hostname)) { + // Need an additional extension to work in chrome-like browsers + debug/* default */.Z.log("[entered] piped"); + const el = await waitForElm(config_selectors.pipedSelector); + if (el) { + let videoIDNew; + let videoID = getVideoId("youtube"); + await translateProccessor(el, "youtube", "piped"); + setInterval(async () => { + videoIDNew = getVideoId("youtube"); + if (videoID !== videoIDNew) { + if (videoIDNew) { + await translateProccessor( + document.querySelector(config_selectors.pipedSelector), + "youtube", + "piped" + ); + } + videoID = videoIDNew; + } + }, 3000); + } + } else if (/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)) { + debug/* default */.Z.log("[entered] vk.com"); + const el = await waitForElm(config_selectors.vkSelector); + if (el) { + await translateProccessor( + document.querySelector(config_selectors.vkSelector), + "vk", + null + ); + let videoIDVKNew; + let videoIDVK = getVideoId("vk"); + setInterval(async () => { + videoIDVKNew = getVideoId("vk"); + if (videoIDVK !== videoIDVKNew) { + if (videoIDVKNew) { + const el = await waitForElm(config_selectors.vkSelector); + if (el) { + await translateProccessor(el, "vk", null); + } + } + videoIDVK = videoIDVKNew; + } + }, 3000); + } + } else if (window.location.hostname.includes("vimeo.com")) { + debug/* default */.Z.log("[entered] vimeo.com"); + const el = await waitForElm(config_selectors.vimeoSelector); + if (el) { + await sleep(1000); + await translateProccessor( + document.querySelector(config_selectors.vimeoSelector), + "vimeo", + null + ); + } + } else if (window.location.hostname.includes("9gag.com")) { + await sleep(1000); + await translateProccessor( + document.querySelector(config_selectors.gagSelector), + "9gag", + null + ); + } else if (window.location.hostname.includes("coub.com")) { + await sleep(1000); + await translateProccessor( + document.querySelector(".viewer__player"), + "coub", + null + ); + } else if (window.location.hostname.includes("rutube.ru")) { + const elementSelector = window.location.pathname.includes("/play/embed") + ? "#app > div > div" + : ".video-player > div > div > div:nth-child(2)"; + + const el = await waitForElm(elementSelector); + if (el) { + await translateProccessor(el, "rutube", null); + } + } else if (window.location.hostname.includes("bilibili.com")) { + if (window.location.pathname.includes("/video/")) { + const el = await waitForElm(config_selectors.bilibilicomSelector); + if (el) { + await translateProccessor(el, "bilibili.com", null); + } + } else if ( + window.location.pathname.includes( + "/blackboard/webplayer/embed-old.html" + ) + ) { + const el = await waitForElm("video"); + if (el) { + await translateProccessor(el.parentElement, "bilibili.com", null); + } + } + } else if (window.location.hostname.includes("twitter.com")) { + const el = await waitForElm(config_selectors.twitterSelector); + if (el) { + let videoIDNew; + let videoID = getVideoId("twitter"); + await translateProccessor(el, "twitter", null); + setInterval(async () => { + videoIDNew = getVideoId("twitter"); + if (videoID !== videoIDNew) { + if (videoIDNew) { + await translateProccessor( + document.querySelector(config_selectors.twitterSelector), + "twitter", + null + ); + } + videoID = videoIDNew; + } + }, 3000); + } + } else if (window.location.hostname.includes("my.mail.ru")) { + const el = await waitForElm(config_selectors.mailSelector); + if (el) { + let videoIDNew; + let videoID = getVideoId("mail.ru"); + await translateProccessor(el, "mail.ru", null); + setInterval(async () => { + videoIDNew = getVideoId("mail.ru"); + if (videoID !== videoIDNew) { + if (videoIDNew) { + await translateProccessor( + document.querySelector(config_selectors.mailSelector), + "mail.ru", + null + ); + } + videoID = videoIDNew; + } + }, 3000); + } + } + } + + await initWebsite(); +} + +src_main().catch((e) => { + console.error(e); +}); + +})(); + +/******/ })() +; \ No newline at end of file diff --git a/src/dist/vot-min.user.js b/src/dist/vot-min.user.js new file mode 100644 index 00000000..c7371043 --- /dev/null +++ b/src/dist/vot-min.user.js @@ -0,0 +1,86 @@ +// ==UserScript== +// @name [VOT] - Voice Over Translation +// @name:de [VOT] - Voice-Over-Video-Übersetzung +// @name:es [VOT] - Traducción de vídeo en off +// @name:fr [VOT] - Traduction vidéo voix-off +// @name:it [VOT] - Traduzione Video fuori campo +// @name:ru [VOT] - Закадровый перевод видео +// @name:zh [VOT] - 画外音视频翻译 +// @description A small extension that adds a Yandex Browser video translation to other browsers +// @description:de Eine kleine Erweiterung, die eine Voice-over-Übersetzung von Videos aus dem Yandex-Browser zu anderen Browsern hinzufügt +// @description:es Una pequeña extensión que agrega una traducción de voz en off de un video de Yandex Browser a otros navegadores +// @description:fr Une petite extension qui ajoute la traduction vocale de la vidéo du Navigateur Yandex à d'autres navigateurs +// @description:it Una piccola estensione che aggiunge la traduzione vocale del video dal browser Yandex ad altri browser +// @description:ru Небольшое расширение, которое добавляет закадровый перевод видео из Яндекс Браузера в другие браузеры +// @description:zh 一个小扩展,它增加了视频从Yandex浏览器到其他浏览器的画外音翻译 +// @version 1.3.4-testing +// @author sodapng, mynovelhost, Toil, SashaXser +// @supportURL https://github.com/ilyhalight/voice-over-translation/issues +// @match *://*.youtube.com/* +// @match *://*.youtube-nocookie.com/* +// @match *://*.twitch.tv/* +// @match *://*.xvideos.com/* +// @match *://*.pornhub.com/* +// @match *://*.vk.com/* +// @match *://*.vk.ru/* +// @match *://invidious.snopyta.org/* +// @match *://invidious.kavin.rocks/* +// @match *://vid.puffyan.us/* +// @match *://invidious.namazso.eu/* +// @match *://inv.riverside.rocks/* +// @match *://yt.artemislena.eu/* +// @match *://invidious.flokinet.to/* +// @match *://invidious.esmailelbob.xyz/* +// @match *://invidious.nerdvpn.de/* +// @match *://invidious.slipfox.xyz/* +// @match *://invidio.xamh.de/* +// @match *://invidious.dhusch.de/* +// @match *://*.piped.video/* +// @match *://piped.tokhmi.xyz/* +// @match *://piped.moomoo.me/* +// @match *://piped.syncpundit.io/* +// @match *://piped.mha.fi/* +// @match *://watch.whatever.social/* +// @match *://piped.garudalinux.org/* +// @match *://efy.piped.pages.dev/* +// @match *://watch.leptons.xyz/* +// @match *://piped.lunar.icu/* +// @match *://yt.dc09.ru/* +// @match *://piped.mint.lgbt/* +// @match *://*.il.ax/* +// @match *://piped.privacy.com.de/* +// @match *://piped.esmailelbob.xyz/* +// @match *://piped.projectsegfau.lt/* +// @match *://piped.in.projectsegfau.lt/* +// @match *://piped.us.projectsegfau.lt/* +// @match *://piped.privacydev.net/* +// @match *://piped.palveluntarjoaja.eu/* +// @match *://piped.smnz.de/* +// @match *://piped.adminforge.de/* +// @match *://piped.qdi.fi/* +// @match *://piped.hostux.net/* +// @match *://piped.chauvet.pro/* +// @match *://piped.jotoma.de/* +// @match *://piped.pfcd.me/* +// @match *://piped.frontendfriendly.xyz/* +// @match *://*.yewtu.be/* +// @match *://inv.vern.cc/* +// @match *://*.vimeo.com/* +// @match *://*.9gag.com/* +// @match *://*.twitter.com/* +// @match *://*.facebook.com/* +// @match *://*.rutube.ru/* +// @match *://*.bilibili.com/* +// @match *://my.mail.ru/* +// @connect api.browser.yandex.ru +// @downloadURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js +// @grant GM_xmlhttpRequest +// @grant GM_info +// @homepageURL https://github.com/ilyhalight/voice-over-translation/issues +// @icon https://translate.yandex.ru/icons/favicon.ico +// @namespace vot +// @require https://cdnjs.cloudflare.com/ajax/libs/protobufjs/7.2.3/protobuf.min.js +// @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js +// ==/UserScript== + +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>a,IM:()=>r,Rr:()=>i,iF:()=>o});const o="api.browser.yandex.ru",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var a=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=o(!0),d=a.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},b={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},y={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function k(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function L(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function F(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in y||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${y[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=y[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(B);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,z)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=y[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=y[V].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=y[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=y[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=y[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${y[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${y[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:y[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:y[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:y[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:y[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),o=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),_=await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=y[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=y[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(y[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),j(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=y[V].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=x("VOTAutoTranslate",O,y[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${y[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=x("VOTDontTranslateYourLang",E,y[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=x("VOTAutoSetVolume",M,y[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=x("VOTShowVideoSlider",D,y[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=x("VOTSyncVolume",I,y[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}function Y(e,t=V){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t)}async function G(e,t){switch(t){case"en":e.detectedLanguage=t,e.responseLanguage=V;break;case"ru":e.detectedLanguage=t,e.responseLanguage=V,"ru"==V&&(e.responseLanguage="en");break;default:if(!Object.keys(v).includes(t))return G(e,"en");e.detectedLanguage=t}return Y(e.detectedLanguage,e.responseLanguage),e}async function W(e,t){if("en"===t)e.responseLanguage=t,e.detectedLanguage="ru";else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return Y(e.detectedLanguage,e.responseLanguage),e}function Z(){o.pause(),c.removeEventListener(".translate",Z,!1),o.src="",o.removeAttribute("src"),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",k("none",y[V].translateVideo),m&&(c.volume=m)}function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}k("none",y[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=(e=!1)=>{if(f.log("lipsync video",c),c)if(o.currentTime=c.currentTime,o.playbackRate=c.playbackRate,e)if("play"!==e)f.log(`lipsync mode is ${e}`),o.pause(),"playing"===e&&(f.log("lipsync mode is playing"),o.play());else{f.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=y[V].grantPermissionToAutoPlay;throw k("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?y[V].neededAdditionalExtension:y[V].audioFormatNotSupported;throw k("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${y[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=$(o,n,i,g);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(te=G(te,te.detectedLanguage),f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V)throw z=!1,y[V].VOTDisableFromYourLang;if(te.isLive)throw y[V].VOTLiveNotSupported;if(te.isPremiere)throw y[V].VOTPremiere;if(_.duration>14400)throw y[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await ae(e,_.detectedLanguage,_.responseLanguage)};function ne(e){f.log(`video ${e.type}`),J(e.type)}function oe(){Z(),K()}function ae(t,a,i){!function(t,n,o,a,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),e(t,n,o,a,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,y[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||y[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?y[V].translationTakeMoreThanHour:t>=10&&t%10?y[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?y[V].translationTakeAboutMinute:y[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):y[V].translationTakeFewMinutes);break;case 3:i(!1,y[V].videoBeingTranslated)}}))}(`${b[d]}${t}`,0x4075500000000000,a,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw k("error",r),r.includes(y[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>ae(t,a,i)),6e4)),r;switch(o.src=r,m=c?.volume,"number"==typeof S&&(o.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(oe(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),k("success",y[V].disableTranslate),X(),function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${y[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=$(c,e,n,w);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),g=o,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const b=document.querySelector(".translationDownload");b.href=r,b.style.display="initial"}))}document.addEventListener("click",(e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${a} ${s} ${l}`),a||s||(l||r(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,n)))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,a))),document.addEventListener("touchstart",(e=>l(e,t,a))),document.addEventListener("touchmove",(e=>l(e,t,a))),document.addEventListener("touchend",(e=>l(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return f.log("[click translationBtn] audio.src is not empty"),void Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw y[V].VOTNoVideoIDFound;await Q(e)}catch(e){k("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw y[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){k("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/src/dist/vot.user.js b/src/dist/vot.user.js new file mode 100644 index 00000000..3f174b9b --- /dev/null +++ b/src/dist/vot.user.js @@ -0,0 +1,3815 @@ +// ==UserScript== +// @name [VOT] - Voice Over Translation +// @name:de [VOT] - Voice-Over-Video-Übersetzung +// @name:es [VOT] - Traducción de vídeo en off +// @name:fr [VOT] - Traduction vidéo voix-off +// @name:it [VOT] - Traduzione Video fuori campo +// @name:ru [VOT] - Закадровый перевод видео +// @name:zh [VOT] - 画外音视频翻译 +// @description A small extension that adds a Yandex Browser video translation to other browsers +// @description:de Eine kleine Erweiterung, die eine Voice-over-Übersetzung von Videos aus dem Yandex-Browser zu anderen Browsern hinzufügt +// @description:es Una pequeña extensión que agrega una traducción de voz en off de un video de Yandex Browser a otros navegadores +// @description:fr Une petite extension qui ajoute la traduction vocale de la vidéo du Navigateur Yandex à d'autres navigateurs +// @description:it Una piccola estensione che aggiunge la traduzione vocale del video dal browser Yandex ad altri browser +// @description:ru Небольшое расширение, которое добавляет закадровый перевод видео из Яндекс Браузера в другие браузеры +// @description:zh 一个小扩展,它增加了视频从Yandex浏览器到其他浏览器的画外音翻译 +// @version 1.3.4-testing +// @author sodapng, mynovelhost, Toil, SashaXser +// @supportURL https://github.com/ilyhalight/voice-over-translation/issues +// @match *://*.youtube.com/* +// @match *://*.youtube-nocookie.com/* +// @match *://*.twitch.tv/* +// @match *://*.xvideos.com/* +// @match *://*.pornhub.com/* +// @match *://*.vk.com/* +// @match *://*.vk.ru/* +// @match *://invidious.snopyta.org/* +// @match *://invidious.kavin.rocks/* +// @match *://vid.puffyan.us/* +// @match *://invidious.namazso.eu/* +// @match *://inv.riverside.rocks/* +// @match *://yt.artemislena.eu/* +// @match *://invidious.flokinet.to/* +// @match *://invidious.esmailelbob.xyz/* +// @match *://invidious.nerdvpn.de/* +// @match *://invidious.slipfox.xyz/* +// @match *://invidio.xamh.de/* +// @match *://invidious.dhusch.de/* +// @match *://*.piped.video/* +// @match *://piped.tokhmi.xyz/* +// @match *://piped.moomoo.me/* +// @match *://piped.syncpundit.io/* +// @match *://piped.mha.fi/* +// @match *://watch.whatever.social/* +// @match *://piped.garudalinux.org/* +// @match *://efy.piped.pages.dev/* +// @match *://watch.leptons.xyz/* +// @match *://piped.lunar.icu/* +// @match *://yt.dc09.ru/* +// @match *://piped.mint.lgbt/* +// @match *://*.il.ax/* +// @match *://piped.privacy.com.de/* +// @match *://piped.esmailelbob.xyz/* +// @match *://piped.projectsegfau.lt/* +// @match *://piped.in.projectsegfau.lt/* +// @match *://piped.us.projectsegfau.lt/* +// @match *://piped.privacydev.net/* +// @match *://piped.palveluntarjoaja.eu/* +// @match *://piped.smnz.de/* +// @match *://piped.adminforge.de/* +// @match *://piped.qdi.fi/* +// @match *://piped.hostux.net/* +// @match *://piped.chauvet.pro/* +// @match *://piped.jotoma.de/* +// @match *://piped.pfcd.me/* +// @match *://piped.frontendfriendly.xyz/* +// @match *://*.yewtu.be/* +// @match *://inv.vern.cc/* +// @match *://*.vimeo.com/* +// @match *://*.9gag.com/* +// @match *://*.twitter.com/* +// @match *://*.facebook.com/* +// @match *://*.rutube.ru/* +// @match *://*.bilibili.com/* +// @match *://my.mail.ru/* +// @connect api.browser.yandex.ru +// @downloadURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js +// @grant GM_xmlhttpRequest +// @grant GM_info +// @homepageURL https://github.com/ilyhalight/voice-over-translation/issues +// @icon https://translate.yandex.ru/icons/favicon.ico +// @namespace vot +// @require https://cdnjs.cloudflare.com/ajax/libs/protobufjs/7.2.3/protobuf.min.js +// @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js +// ==/UserScript== + +/******/ (() => { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ({ + +/***/ "./node_modules/css-loader/dist/cjs.js!./src/styles/main.css": +/***/ ((module, __webpack_exports__, __webpack_require__) => { + +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./node_modules/css-loader/dist/runtime/noSourceMaps.js"); +/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./node_modules/css-loader/dist/runtime/api.js"); +/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__); +// Imports + + +var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default())); +// Module +___CSS_LOADER_EXPORT___.push([module.id, `.translationBlock { + padding: 0.45rem !important; + width: max-content; + position: absolute; + background: #2e2f34; + border-radius: 0.5rem !important; + left: 50%; + top: 5rem; + transform: translate(-50%); + text-align: center; + opacity: 0; + transition: opacity 1s; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + z-index: 100; +} + +.translationBtn { + position: relative; + display: inline-block; + vertical-align: middle; + color: #fff; + padding-right: 0.25rem !important; + cursor: pointer; + font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif; +} + +.translationBlock:hover { + opacity: 1; +} + +.translationMenu { + display: inline-block; + vertical-align: middle; + border-left: 1px solid #424348; + max-height: 16px; + max-width: 24px; + cursor: pointer; +} + +.translationMenuIcon { + padding: 0 10px !important; + width: 24px; +} + +.translationIAlice { + display: inline-block; + vertical-align: middle; + max-height: 26px; + max-width: 50px; +} + +.translationIconAlice { + height: 24px !important; + width: 24px !important; +} + +.translationITranslate { + display: inline-block; + vertical-align: middle; + max-height: 20px; + max-width: 20px; +} + +.translationMenuContent { + position: absolute; + background: #2e2f34; + color: #fff; + display: none; + border-radius: 1rem !important; + left: 50%; + top: 10rem; + transform: translate(-50%); + text-align: left; + font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important; + + width: 300px; + /* height: 375px; */ + opacity: 0; + z-index: 100; + transition: opacity 0.5s ease; +} + +.VOTMenuSlider { + -webkit-appearance: none !important; + appearance: none !important; + width: 268px !important; + height: 8px !important; + outline: none !important; + margin-top: 0.5rem; + opacity: 0.7; + /* background: #3C3F4D !important; */ + background: rgb(253, 222, 85, 0.6) !important; + border: none !important; + border-radius: 2rem !important; + -webkit-transition: 0.2s !important; + transition: opacity 0.2s ease !important; +} + +.VOTMenuSlider:hover { + opacity: 1; +} + +.VOTMenuSlider::-webkit-slider-thumb { + -webkit-appearance: none !important; + appearance: none !important; + width: 10px !important; + height: 10px !important; + border-radius: 50% !important; + border: none !important; + background: #fff !important; + cursor: pointer !important; +} + +.VOTMenuSlider::-moz-range-thumb { + width: 10px !important; + height: 10px !important; + border-radius: 50% !important; + border: none !important; + background: #fff !important; + cursor: pointer !important; +} + +.VOTMenuSlider::-ms-thumb { + width: 10px !important; + height: 10px !important; + border-radius: 50% !important; + border: none !important; + background: #fff !important; + cursor: pointer !important; +} + +.VOTMenuSlider::-ms-fill-lower { + height: 8px !important; + border-radius: 2rem !important; + background: linear-gradient( + 90.1deg, + rgba(186, 153, 244, 0.85) -5.78%, + rgba(236, 138, 202, 0.7) 56.46%, + rgba(239, 168, 117, 0.6) 108.93% + ) !important; +} + +.VOTMenuSlider::-moz-range-progress { + height: 8px !important; + border-radius: 2rem !important; + background: linear-gradient( + 90.1deg, + rgba(186, 153, 244, 0.85) -5.78%, + rgba(236, 138, 202, 0.7) 56.46%, + rgba(239, 168, 117, 0.6) 108.93% + ) !important; +} + +.translationHeader { + padding-bottom: 0.5rem !important; +} + +.translationMainHeader { + margin: 16px !important; + color: #fff; + font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important; +} + +.translationMenuOptions { + display: flex; + flex-flow: column wrap; +} + +.translationMenuContainer { + /* width: 100%; */ + padding-left: 16px !important; + padding-top: 5px !important; + display: inline-block !important; +} + +.translationMenuContainer > input { + appearance: auto !important; + vertical-align: text-bottom; +} + +.translationMenuText { + color: #fff; + display: inline-flex; + width: 80%; +} + +.translationVolumeBox, +.translationVideoVolumeBox { + padding-top: 0.5rem !important; +} + +.translationDropDB { + border: none !important; + border-radius: 4px !important; + background: #5426ff !important; + color: #fff !important; + padding: 6px 16px !important; + margin-left: auto !important; + cursor: pointer !important; +} + +.translationDownload { + background: #5426ff !important; + color: #fff !important; + padding: 2px 10px !important; + border-radius: 4px !important; + cursor: pointer; + display: none; +} + +.translationMenuFunctional { + display: flex; + margin: 16px !important; +} + +.VOTMenuSelect { + width: 110px; + border-radius: 5px !important; + border: 1px solid #dadce0 !important; + box-shadow: 0 1px 3px -2px #9098a9; + box-sizing: border-box !important; + color: #2e2f34 !important; + background: #fff !important; + padding: 5px !important; +} + +.VOTMenuSelect:focus { + outline: none; +} + +.VOTMenuSelect:focus { + outline: none; + border-color: #0077ff; + box-shadow: 0 0 0 2px rgba(#0077ff, 0.2); +} + +#VOTSelectLanguages { + display: flex !important; + margin-left: 5px; +} + +#VOTSelectLanguages svg { + margin: 0 5px; +} +`, ""]); +// Exports +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___); + + +/***/ }), + +/***/ "./node_modules/css-loader/dist/runtime/api.js": +/***/ ((module) => { + + + +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +module.exports = function (cssWithMappingToString) { + var list = []; + + // return the list of modules as css string + list.toString = function toString() { + return this.map(function (item) { + var content = ""; + var needLayer = typeof item[5] !== "undefined"; + if (item[4]) { + content += "@supports (".concat(item[4], ") {"); + } + if (item[2]) { + content += "@media ".concat(item[2], " {"); + } + if (needLayer) { + content += "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {"); + } + content += cssWithMappingToString(item); + if (needLayer) { + content += "}"; + } + if (item[2]) { + content += "}"; + } + if (item[4]) { + content += "}"; + } + return content; + }).join(""); + }; + + // import a list of modules into the list + list.i = function i(modules, media, dedupe, supports, layer) { + if (typeof modules === "string") { + modules = [[null, modules, undefined]]; + } + var alreadyImportedModules = {}; + if (dedupe) { + for (var k = 0; k < this.length; k++) { + var id = this[k][0]; + if (id != null) { + alreadyImportedModules[id] = true; + } + } + } + for (var _k = 0; _k < modules.length; _k++) { + var item = [].concat(modules[_k]); + if (dedupe && alreadyImportedModules[item[0]]) { + continue; + } + if (typeof layer !== "undefined") { + if (typeof item[5] === "undefined") { + item[5] = layer; + } else { + item[1] = "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {").concat(item[1], "}"); + item[5] = layer; + } + } + if (media) { + if (!item[2]) { + item[2] = media; + } else { + item[1] = "@media ".concat(item[2], " {").concat(item[1], "}"); + item[2] = media; + } + } + if (supports) { + if (!item[4]) { + item[4] = "".concat(supports); + } else { + item[1] = "@supports (".concat(item[4], ") {").concat(item[1], "}"); + item[4] = supports; + } + } + list.push(item); + } + }; + return list; +}; + +/***/ }), + +/***/ "./node_modules/css-loader/dist/runtime/noSourceMaps.js": +/***/ ((module) => { + + + +module.exports = function (i) { + return i[1]; +}; + +/***/ }), + +/***/ "./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js": +/***/ ((module) => { + + + +var stylesInDOM = []; +function getIndexByIdentifier(identifier) { + var result = -1; + for (var i = 0; i < stylesInDOM.length; i++) { + if (stylesInDOM[i].identifier === identifier) { + result = i; + break; + } + } + return result; +} +function modulesToDom(list, options) { + var idCountMap = {}; + var identifiers = []; + for (var i = 0; i < list.length; i++) { + var item = list[i]; + var id = options.base ? item[0] + options.base : item[0]; + var count = idCountMap[id] || 0; + var identifier = "".concat(id, " ").concat(count); + idCountMap[id] = count + 1; + var indexByIdentifier = getIndexByIdentifier(identifier); + var obj = { + css: item[1], + media: item[2], + sourceMap: item[3], + supports: item[4], + layer: item[5] + }; + if (indexByIdentifier !== -1) { + stylesInDOM[indexByIdentifier].references++; + stylesInDOM[indexByIdentifier].updater(obj); + } else { + var updater = addElementStyle(obj, options); + options.byIndex = i; + stylesInDOM.splice(i, 0, { + identifier: identifier, + updater: updater, + references: 1 + }); + } + identifiers.push(identifier); + } + return identifiers; +} +function addElementStyle(obj, options) { + var api = options.domAPI(options); + api.update(obj); + var updater = function updater(newObj) { + if (newObj) { + if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap && newObj.supports === obj.supports && newObj.layer === obj.layer) { + return; + } + api.update(obj = newObj); + } else { + api.remove(); + } + }; + return updater; +} +module.exports = function (list, options) { + options = options || {}; + list = list || []; + var lastIdentifiers = modulesToDom(list, options); + return function update(newList) { + newList = newList || []; + for (var i = 0; i < lastIdentifiers.length; i++) { + var identifier = lastIdentifiers[i]; + var index = getIndexByIdentifier(identifier); + stylesInDOM[index].references--; + } + var newLastIdentifiers = modulesToDom(newList, options); + for (var _i = 0; _i < lastIdentifiers.length; _i++) { + var _identifier = lastIdentifiers[_i]; + var _index = getIndexByIdentifier(_identifier); + if (stylesInDOM[_index].references === 0) { + stylesInDOM[_index].updater(); + stylesInDOM.splice(_index, 1); + } + } + lastIdentifiers = newLastIdentifiers; + }; +}; + +/***/ }), + +/***/ "./node_modules/style-loader/dist/runtime/insertBySelector.js": +/***/ ((module) => { + + + +var memo = {}; + +/* istanbul ignore next */ +function getTarget(target) { + if (typeof memo[target] === "undefined") { + var styleTarget = document.querySelector(target); + + // Special case to return head of iframe instead of iframe itself + if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) { + try { + // This will throw an exception if access to iframe is blocked + // due to cross-origin restrictions + styleTarget = styleTarget.contentDocument.head; + } catch (e) { + // istanbul ignore next + styleTarget = null; + } + } + memo[target] = styleTarget; + } + return memo[target]; +} + +/* istanbul ignore next */ +function insertBySelector(insert, style) { + var target = getTarget(insert); + if (!target) { + throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid."); + } + target.appendChild(style); +} +module.exports = insertBySelector; + +/***/ }), + +/***/ "./node_modules/style-loader/dist/runtime/insertStyleElement.js": +/***/ ((module) => { + + + +/* istanbul ignore next */ +function insertStyleElement(options) { + var element = document.createElement("style"); + options.setAttributes(element, options.attributes); + options.insert(element, options.options); + return element; +} +module.exports = insertStyleElement; + +/***/ }), + +/***/ "./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js": +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + + + +/* istanbul ignore next */ +function setAttributesWithoutAttributes(styleElement) { + var nonce = true ? __webpack_require__.nc : 0; + if (nonce) { + styleElement.setAttribute("nonce", nonce); + } +} +module.exports = setAttributesWithoutAttributes; + +/***/ }), + +/***/ "./node_modules/style-loader/dist/runtime/styleDomAPI.js": +/***/ ((module) => { + + + +/* istanbul ignore next */ +function apply(styleElement, options, obj) { + var css = ""; + if (obj.supports) { + css += "@supports (".concat(obj.supports, ") {"); + } + if (obj.media) { + css += "@media ".concat(obj.media, " {"); + } + var needLayer = typeof obj.layer !== "undefined"; + if (needLayer) { + css += "@layer".concat(obj.layer.length > 0 ? " ".concat(obj.layer) : "", " {"); + } + css += obj.css; + if (needLayer) { + css += "}"; + } + if (obj.media) { + css += "}"; + } + if (obj.supports) { + css += "}"; + } + var sourceMap = obj.sourceMap; + if (sourceMap && typeof btoa !== "undefined") { + css += "\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), " */"); + } + + // For old IE + /* istanbul ignore if */ + options.styleTagTransform(css, styleElement, options.options); +} +function removeStyleElement(styleElement) { + // istanbul ignore if + if (styleElement.parentNode === null) { + return false; + } + styleElement.parentNode.removeChild(styleElement); +} + +/* istanbul ignore next */ +function domAPI(options) { + if (typeof document === "undefined") { + return { + update: function update() {}, + remove: function remove() {} + }; + } + var styleElement = options.insertStyleElement(options); + return { + update: function update(obj) { + apply(styleElement, options, obj); + }, + remove: function remove() { + removeStyleElement(styleElement); + } + }; +} +module.exports = domAPI; + +/***/ }), + +/***/ "./node_modules/style-loader/dist/runtime/styleTagTransform.js": +/***/ ((module) => { + + + +/* istanbul ignore next */ +function styleTagTransform(css, styleElement) { + if (styleElement.styleSheet) { + styleElement.styleSheet.cssText = css; + } else { + while (styleElement.firstChild) { + styleElement.removeChild(styleElement.firstChild); + } + styleElement.appendChild(document.createTextNode(css)); + } +} +module.exports = styleTagTransform; + +/***/ }), + +/***/ "./src/config/config.js": +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ I1: () => (/* binding */ yandexHmacKey), +/* harmony export */ IM: () => (/* binding */ autoVolume), +/* harmony export */ Rr: () => (/* binding */ yandexUserAgent), +/* harmony export */ iF: () => (/* binding */ workerHost) +/* harmony export */ }); +// CONFIGURATION +const workerHost = "api.browser.yandex.ru"; +const yandexHmacKey = "gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"; +const yandexUserAgent = + "Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1"; +const autoVolume = 0.15; // 0.0 - 1.0 (0% - 100%) - default volume of the video with the translation + + + + +/***/ }), + +/***/ "./src/rvt.js": +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +// ESM COMPAT FLAG +__webpack_require__.r(__webpack_exports__); + +// EXPORTS +__webpack_require__.d(__webpack_exports__, { + "default": () => (/* binding */ rvt) +}); + +;// CONCATENATED MODULE: ./src/getUUID.js +function getUUID(isLower) { + const uuid = ([1e7] + 1e3 + 4e3 + 8e3 + 1e11).replace(/[018]/g, (c) => + ( + c ^ + (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4))) + ).toString(16) + ); + return isLower ? uuid : uuid.toUpperCase(); +} + + + +// EXTERNAL MODULE: ./src/yandexRequests.js +var yandexRequests = __webpack_require__("./src/yandexRequests.js"); +// EXTERNAL MODULE: ./src/config/config.js +var config = __webpack_require__("./src/config/config.js"); +;// CONCATENATED MODULE: ./src/rvt.js + + + + +// Request video translation from Yandex API +async function requestVideoTranslation( + url, + unknown1, + requestLang, + responseLang, + callback +) { + // Initialize variables + const deviceId = getUUID(true); + const body = yandexRequests/* yandexRequests */.G.encodeRequest( + url, + deviceId, + unknown1, + requestLang, + responseLang + ); + + try { + // Create a key from the HMAC secret + const utf8Encoder = new TextEncoder("utf-8"); + const key = await window.crypto.subtle.importKey( + "raw", + utf8Encoder.encode(config/* yandexHmacKey */.I1), + { name: "HMAC", hash: { name: "SHA-256" } }, + false, + ["sign", "verify"] + ); + // Sign the body with the key + const signature = await window.crypto.subtle.sign("HMAC", key, body); + // Convert the signature to a hex string + const hexSignature = Array.from(new Uint8Array(signature), (x) => + x.toString(16).padStart(2, "0") + ).join(""); + // Create a fetch options object with headers and body + const options = { + // url: `https://${workerHost}/stream-translation/whitelist-stream`, + // url: `https://${workerHost}/stream-translation/translate-stream`, + url: `https://${config/* workerHost */.iF}/video-translation/translate`, + method: "POST", + headers: { + Accept: "application/x-protobuf", + "Accept-Language": "en", + "Content-Type": "application/x-protobuf", + "User-Agent": config/* yandexUserAgent */.Rr, + Pragma: "no-cache", + "Cache-Control": "no-cache", + "Sec-Fetch-Mode": "no-cors", + "sec-ch-ua": null, + "sec-ch-ua-mobile": null, + "sec-ch-ua-platform": null, + "Vtrans-Signature": hexSignature, + "Sec-Vtrans-Token": getUUID(false), + }, + data: String.fromCharCode(...body), + responseType: "arraybuffer", + }; + // Send the request using GM_xmlhttpRequest + GM_xmlhttpRequest({ + ...options, + onload: (http) => { + callback(http.status === 200, http.response); + }, + onerror: (error) => { + callback(false); + }, + }); + } catch (exception) { + // Handle errors + callback(false); + } +} + +/* harmony default export */ const rvt = (requestVideoTranslation); + + +/***/ }), + +/***/ "./src/yandexRequests.js": +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ G: () => (/* binding */ yandexRequests) +/* harmony export */ }); +const VideoTranslationRequest = new protobuf.Type("VideoTranslationRequest") + .add(new protobuf.Field("url", 3, "string")) + .add(new protobuf.Field("deviceId", 4, "string")) + .add(new protobuf.Field("firstRequest", 5, "bool")) // true for the first request, false for subsequent ones + .add(new protobuf.Field("unknown1", 6, "fixed64")) + .add(new protobuf.Field("unknown2", 7, "int32")) // 1 1 + .add(new protobuf.Field("language", 8, "string")) // source language code + .add(new protobuf.Field("unknown3", 9, "int32")) // 0 0 + .add(new protobuf.Field("unknown4", 10, "int32")) // 0 0 + .add(new protobuf.Field("translationHelp", 11, "int32")) // array for translation assistance ([0] -> {2: link to video, 1: "video_file_url"}, [1] -> {2: link to subtitles, 1: "subtitles_file_url"}) + .add(new protobuf.Field("responseLanguage", 14, "string")); // target language code + +// const VideoWhitelistStreamRequest = new protobuf.Type("VideoWhitelistStreamRequest") +// .add(new protobuf.Field("url", 1, "string")) +// .add(new protobuf.Field("deviceId", 4, "string")) + +// const VideoTranslationStreamRequest = new protobuf.Type("VideoTranslationStreamRequest") +// .add(new protobuf.Field("url", 1, "string")) +// .add(new protobuf.Field("language", 2, "string")) +// .add(new protobuf.Field("responseLanguage", 3, "string")) + +const VideoTranslationResponse = new protobuf.Type("VideoTranslationResponse") + .add(new protobuf.Field("url", 1, "string")) + .add(new protobuf.Field("duration", 2, "double")) + .add(new protobuf.Field("status", 4, "int32")) // status + .add(new protobuf.Field("remainingTime", 5, "int32")) // secs before translation + .add(new protobuf.Field("language", 8, "string")) // detected language (if the wrong one is set) + .add(new protobuf.Field("message", 9, "string")); +// 6 - unknown 0 (1st request) -> 10 (2nd, 3th and etc requests) +// 7 - unknown array + +// const VideoWhitelistStreamResponse = new protobuf.Type("VideoWhitelistStreamResponse") +// .add(new protobuf.Field("inWhitelist", 1, "bool")) + +// const VideoTranslationStreamResponse = new protobuf.Type("VideoTranslationStreamResponse") +// .add(new protobuf.Field("unknown1", 1, "int32")) +// .add(new protobuf.Field("array", 2, "string")) +// .add(new protobuf.Field("ping", 3, "int32")) + +// Create a root namespace and add the types +// const root = new protobuf.Root().define("yandex").add(VideoWhitelistStreamRequest).add(VideoWhitelistStreamResponse); + +// // Export the encoding and decoding functions +// export const yandexRequests = { +// encodeRequest(url, deviceId, unknown1, requestLang, responseLang) { +// return root.VideoWhitelistStreamRequest.encode({ +// url, +// deviceId: 'UCLA_DiR1FfKNvjuUpBHmylQ' +// }).finish(); +// }, +// decodeResponse(response) { +// return root.VideoWhitelistStreamResponse.decode(new Uint8Array(response)); +// } +// }; + +// // Create a root namespace and add the types +// const root = new protobuf.Root().define("yandex").add(VideoTranslationStreamRequest).add(VideoTranslationStreamResponse); + +// // Export the encoding and decoding functions +// export const yandexRequests = { +// encodeRequest(url, deviceId, unknown1, requestLang, responseLang) { +// return root.VideoTranslationStreamRequest.encode({ +// url, +// language: requestLang, +// responseLanguage: responseLang +// }).finish(); +// }, +// decodeResponse(response) { +// return root.VideoTranslationStreamResponse.decode(new Uint8Array(response)); +// } +// }; + +// Create a root namespace and add the types +const root = new protobuf.Root() + .define("yandex") + .add(VideoTranslationRequest) + .add(VideoTranslationResponse); + +// Export the encoding and decoding functions +const yandexRequests = { + encodeRequest(url, deviceId, unknown1, requestLang, responseLang) { + return root.VideoTranslationRequest.encode({ + url, + deviceId, + firstRequest: true, + unknown1, + unknown2: 1, + language: requestLang, + unknown3: 0, + unknown4: 0, + responseLanguage: responseLang, + }).finish(); + }, + decodeResponse(response) { + return root.VideoTranslationResponse.decode(new Uint8Array(response)); + }, +}; + + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ id: moduleId, +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/compat get default export */ +/******/ (() => { +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = (module) => { +/******/ var getter = module && module.__esModule ? +/******/ () => (module['default']) : +/******/ () => (module); +/******/ __webpack_require__.d(getter, { a: getter }); +/******/ return getter; +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/define property getters */ +/******/ (() => { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ (() => { +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ (() => { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = (exports) => { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/nonce */ +/******/ (() => { +/******/ __webpack_require__.nc = undefined; +/******/ })(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. +(() => { + +// EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js +var injectStylesIntoStyleTag = __webpack_require__("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"); +var injectStylesIntoStyleTag_default = /*#__PURE__*/__webpack_require__.n(injectStylesIntoStyleTag); +// EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/styleDomAPI.js +var styleDomAPI = __webpack_require__("./node_modules/style-loader/dist/runtime/styleDomAPI.js"); +var styleDomAPI_default = /*#__PURE__*/__webpack_require__.n(styleDomAPI); +// EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/insertBySelector.js +var insertBySelector = __webpack_require__("./node_modules/style-loader/dist/runtime/insertBySelector.js"); +var insertBySelector_default = /*#__PURE__*/__webpack_require__.n(insertBySelector); +// EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js +var setAttributesWithoutAttributes = __webpack_require__("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"); +var setAttributesWithoutAttributes_default = /*#__PURE__*/__webpack_require__.n(setAttributesWithoutAttributes); +// EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/insertStyleElement.js +var insertStyleElement = __webpack_require__("./node_modules/style-loader/dist/runtime/insertStyleElement.js"); +var insertStyleElement_default = /*#__PURE__*/__webpack_require__.n(insertStyleElement); +// EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/styleTagTransform.js +var styleTagTransform = __webpack_require__("./node_modules/style-loader/dist/runtime/styleTagTransform.js"); +var styleTagTransform_default = /*#__PURE__*/__webpack_require__.n(styleTagTransform); +// EXTERNAL MODULE: ./node_modules/css-loader/dist/cjs.js!./src/styles/main.css +var main = __webpack_require__("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"); +;// CONCATENATED MODULE: ./src/styles/main.css + + + + + + + + + + + +var options = {}; + +options.styleTagTransform = (styleTagTransform_default()); +options.setAttributes = (setAttributesWithoutAttributes_default()); + + options.insert = insertBySelector_default().bind(null, "head"); + +options.domAPI = (styleDomAPI_default()); +options.insertStyleElement = (insertStyleElement_default()); + +var update = injectStylesIntoStyleTag_default()(main/* default */.Z, options); + + + + + /* harmony default export */ const styles_main = (main/* default */.Z && main/* default */.Z.locals ? main/* default */.Z.locals : undefined); + +;// CONCATENATED MODULE: ./src/utils/getYTVideoData.js +async function detect(cleanText) { + const response = await fetch("https://rust-server-531j.onrender.com/detect", { + method: "POST", + body: cleanText, + }); + return await response.text(); +} + +// Get the language code from the response or the text +async function getLanguage(player, response, title, description, author) { + if (!window.location.hostname.includes("m.youtube.com")) { + // ! Experimental ! get lang from selected audio track if availabled + const audioTracks = player.getAudioTrack(); + const trackInfo = audioTracks?.getLanguageInfo(); // get selected track info (id === "und" if tracks are not available) + if (trackInfo?.id !== "und") { + return trackInfo.id.split(".")[0]; + } + } + + // TODO: If the audio tracks will work fine, transfer the receipt of captions to the audioTracks variable + // Check if there is an automatic caption track in the response + const captionTracks = + response?.captions?.playerCaptionsTracklistRenderer?.captionTracks; + if (captionTracks?.length) { + const autoCaption = captionTracks.find((caption) => caption.kind === "asr"); + if (autoCaption) { + return autoCaption.languageCode; + } + } + // If there is no caption track, use detect to get the language code from the text + const text = [title, description, author].join(" "); + // Remove anything that is not a letter or a space in any language + const cleanText = text + .replace(/https?:\/\/\S+/g, "") + .replace(/[^\p{L}\s]/gu, "") + .trim() + .slice(0, 250); + return await detect(cleanText); +} + +// Get the video data from the player +async function getYTVideoData() { + const player = document.querySelector("#movie_player"); + const data = player.getVideoData(); + const response = player.getPlayerResponse(); + const { isLive, isPremiere, title, author } = data; + const { shortDescription: description } = response?.videoDetails ?? {}; + const videoData = { + isLive, + isPremiere, + title, + description, + author, + detectedLanguage: await getLanguage( + player, + response, + title, + description, + author + ), + }; + console.log("VOT Detected language: ", videoData.detectedLanguage); + return videoData; +} + + + +// EXTERNAL MODULE: ./src/yandexRequests.js +var yandexRequests = __webpack_require__("./src/yandexRequests.js"); +;// CONCATENATED MODULE: ./src/config/constants.js +const translateFuncParam = 0x40_75_50_00_00_00_00_00; +const availableLangs = { + ru: "Russian", + en: "English", + zh: "Chinese", + fr: "French", + it: "Italian", + es: "Spanish", + de: "German", +}; // available languages for translation +const siteTranslates = { + youtube: "https://youtu.be/", + twitch: "https://twitch.tv/", + vimeo: "https://vimeo.com/", + "9gag": "https://9gag.com/gag/", + vk: "https://vk.com/video?z=", + xvideos: "https://www.xvideos.com/", + pornhub: "https://rt.pornhub.com/view_video.php?viewkey=", + udemy: "https://www.udemy.com", + twitter: "https://twitter.com/i/status/", + facebook: "https://www.facebook.com/", + rutube: "https://rutube.ru/video/", + "bilibili.com": "https://www.bilibili.com/video/", + "mail.ru": "https://my.mail.ru/", + coub: "https://coub.com/view/", +}; +const translations = { + ru: { + recommended: "рекомендуется", + translateVideo: "Перевести видео", + disableTranslate: "Выключить", + translationSettings: "Настройки перевода", + resetSettings: "Сбросить настройки", + videoBeingTranslated: "Видео переводится", + videoLanguage: "Язык видео", + translationLanguage: "Язык перевода", + translationTake: "Перевод займёт", + translationTakeMoreThanHour: "Перевод займёт больше часа", + translationTakeAboutMinute: "Перевод займёт около минуты", + translationTakeFewMinutes: "Перевод займёт несколько минут", + translationTakeApproximatelyMinutes: "Перевод займёт примерно {0} минут", + translationTakeApproximatelyMinute: "Перевод займёт примерно {0} минуты", + unSupportedExtensionError: `Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`, + requestTranslationFailed: "Не удалось запросить перевод видео", + audioNotReceived: "Не получена ссылка на аудио", + grantPermissionToAutoPlay: "Предоставьте разрешение на автовоспроизведение", + neededAdditionalExtension: + "Для поддержки этого сайта необходимо дополнительное расширение", + audioFormatNotSupported: "Формат аудио не поддерживается", + VOTAutoTranslate: "Переводить при открытии", + VOTDontTranslateYourLang: "Не переводить с родного языка", + VOTVolume: "Громкость видео", + VOTVolumeTranslation: "Громкость перевода", + VOTAutoSetVolume: "Уменьшать громкость видео до ", + VOTShowVideoSlider: "Слайдер громкости видео", + VOTSyncVolume: "Связать громкость перевода и видео", + VOTAudioProxy: "Проксировать полученное аудио", + VOTDisableFromYourLang: "VOT: Вы отключили перевод видео на вашем языке", + VOTLiveNotSupported: + "VOT: Не поддерживается перевод трансляций в прямом эфире", + VOTPremiere: "VOT: Дождитесь окончания премьеры перед переводом", + VOTVideoIsTooLong: "VOT: Видео слишком длинное", + VOTNoVideoIDFound: "VOT: Не найдено ID видео", + VOTFailedInitDB: "VOT: Не удалось инициализовать базу данных", + VOTDBNeedUpdate: + "VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу", + VOTDisabledForDBUpdating: `VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`, + VOTFailedWriteToDB: "VOT: Не удалось записать данные в базу данных", + VOTFailedReadFromDB: "VOT: Не удалось получить данные из базы данных", + Russian: "Русский", + English: "Английский", + Chinese: "Китайский", + French: "Французский", + Italian: "Итальянский", + Spanish: "Испанский", + German: "Немецкий", + }, + en: { + recommended: "recommended", + translateVideo: "Translate video", + disableTranslate: "Turn off", + translationSettings: "Translation settings", + resetSettings: "Reset settings", + videoBeingTranslated: "The video is being translated", + videoLanguage: "Video language", + translationLanguage: "Translation language", + translationTake: "The translation will take", + translationTakeMoreThanHour: "The translation will take more than an hour", + translationTakeAboutMinute: "The translation will take about a minute", + translationTakeFewMinutes: "The translation will take a few minutes", + translationTakeApproximatelyMinutes: + "The translation will take approximately {0} minutes", + translationTakeApproximatelyMinute: + "The translation will take approximately {0} minutes", + unSupportedExtensionError: `Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`, + requestTranslationFailed: "Failed to request video translation", + audioNotReceived: "Audio link not received", + grantPermissionToAutoPlay: "Grant permission to autoplay", + neededAdditionalExtension: + "An additional extension is needed to support this site", + audioFormatNotSupported: "The audio format is not supported", + VOTAutoTranslate: "Translate on open", + VOTDontTranslateYourLang: "Do not translate from my language", + VOTVolume: "Video volume", + VOTVolumeTranslation: "Translation Volume", + VOTAutoSetVolume: "Reduce video volume to ", + VOTShowVideoSlider: "Video volume slider", + VOTSyncVolume: "Link translation and video volume", + VOTAudioProxy: "Proxy received audio", + VOTDisableFromYourLang: + "VOT: You have disabled the translation of the video in your language", + VOTLiveNotSupported: "VOT: Translation of live streams is not supported", + VOTPremiere: "VOT: Wait for the premiere to end before translating", + VOTVideoIsTooLong: "VOT: Video is too long", + VOTNoVideoIDFound: "VOT: No video ID found", + VOTFailedInitDB: "VOT: Failed to initialize database", + VOTDBNeedUpdate: + "VOT: The database needs an update, please reload the page", + VOTDisabledForDBUpdating: `VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`, + VOTFailedWriteToDB: "VOT: Data could not be written to the database", + VOTFailedReadFromDB: "VOT: Data could not be retrieved from the database", + Russian: "Russian", + English: "English", + Chinese: "Chinese", + French: "French", + Italian: "Italian", + Spanish: "Spanish", + German: "German", + }, + zh: { + recommended: "推荐使用", + translateVideo: "翻译视频", + disableTranslate: "关掉", + translationSettings: "翻译需要一个多小时", + resetSettings: "重置设置", + videoBeingTranslated: "视频正在翻译中", + videoLanguage: "视频语言", + translationLanguage: "翻译语言", + translationTake: "翻译将采取", + translationTakeMoreThanHour: "翻译将采取一个多小时", + translationTakeAboutMinute: "翻译将采取一分钟", + translationTakeFewMinutes: "翻译将采取几分钟", + translationTakeApproximatelyMinutes: "翻译将采取大约需要{0}分钟", + translationTakeApproximatelyMinute: "翻译将采取大约需要{0}分钟", + unSupportedExtensionError: `错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`, + requestTranslationFailed: "请求视频翻译失败", + audioNotReceived: "未收到音频链接", + grantPermissionToAutoPlay: "授予自动播放权限", + neededAdditionalExtension: "需要一个额外的扩展来支持这个网站", + audioFormatNotSupported: "不支持音频格式", + VOTAutoTranslate: "打开时翻译", + VOTDontTranslateYourLang: "不要从你的语言翻译过来", + VOTVolume: "视频量", + VOTVolumeTranslation: "翻译量", + VOTAutoSetVolume: "将视频音量降低到", + VOTShowVideoSlider: "视频音量滑块", + VOTSyncVolume: "链接翻译和视频音量", + VOTAudioProxy: "代理接收的音频", + VOTDisableFromYourLang: "VOT:你已经禁用了你的语言的视频翻译", + VOTLiveNotSupported: "VOT:不支持直播流的翻译", + VOTPremiere: "VOT:等待首映结束后再翻译", + VOTVideoIsTooLong: "VOT:视频太长", + VOTNoVideoIDFound: "VOT: 没有找到视频ID", + VOTFailedInitDB: "VOT: 初始化数据库失败", + VOTDBNeedUpdate: "VOT: 数据库需要更新,请重新加载页面", + VOTDisabledForDBUpdating: `VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`, + VOTFailedWriteToDB: "VOT: 无法将数据写入数据库", + VOTFailedReadFromDB: "VOT: 无法从数据库中检索数据", + Russian: "俄语", + English: "英语", + Chinese: "中文", + French: "法语", + Italian: "意大利语", + Spanish: "西班牙语", + German: "德语", + }, + de: { + recommended: "es wird empfohlen", + translateVideo: "Video übersetzen", + disableTranslate: "Ausschalten", + translationSettings: "Übersetzungseinstellungen", + resetSettings: "Einstellungen zurücksetzen", + videoBeingTranslated: "Das Video wird übersetzt", + videoLanguage: "Sprache Video", + translationLanguage: "Zielsprache", + translationTake: "Die Übersetzung dauert", + translationTakeMoreThanHour: "Die Übersetzung dauert mehr als eine Stunde", + translationTakeAboutMinute: "Die Übersetzung dauert ungefähr eine Minute", + translationTakeFewMinutes: "Die Übersetzung dauert einige Minuten", + translationTakeApproximatelyMinutes: + "Die Übersetzung dauert ungefähr {0} Minuten", + translationTakeApproximatelyMinute: + "Die Übersetzung dauert ungefähr {0} Minuten", + unSupportedExtensionError: `Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`, + requestTranslationFailed: + "Videoübersetzung konnte nicht angefordert werden", + audioNotReceived: "Audiolink nicht empfangen", + grantPermissionToAutoPlay: + "Erteilen Sie die Berechtigung zur automatischen Wiedergabe", + neededAdditionalExtension: + "Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen", + audioFormatNotSupported: "Das Audioformat wird nicht unterstützt", + VOTAutoTranslate: "Beim Öffnen übersetzen", + VOTDontTranslateYourLang: "Nicht aus Ihrer Sprache übersetzen", + VOTVolume: "Video Lautstärke", + VOTVolumeTranslation: "Übersetzungsvolumen", + VOTAutoSetVolume: "Video-Lautstärke auf reduzieren ", + VOTShowVideoSlider: "Video-Lautstärkeregler", + VOTSyncVolume: "Übersetzungs- und Videolautstärke verknüpfen", + VOTAudioProxy: "Empfangenes Audio proxyen", + VOTDisableFromYourLang: + "VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert", + VOTLiveNotSupported: + "VOT: Übersetzung von Live-Streams wird nicht unterstützt", + VOTPremiere: + "VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen", + VOTVideoIsTooLong: "VOT: Video ist zu lang", + VOTNoVideoIDFound: "VOT: Keine Video-ID gefunden", + VOTFailedInitDB: "VOT: Datenbank konnte nicht initialisiert werden", + VOTDBNeedUpdate: + "VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu", + VOTDisabledForDBUpdating: `VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`, + VOTFailedWriteToDB: + "VOT: Daten konnten nicht in die Datenbank geschrieben werden", + VOTFailedReadFromDB: "VOT: Konnte keine Daten aus der Datenbank abrufen", + Russian: "Russisch", + English: "Englisch", + Chinese: "Chinesisch", + French: "Französisch", + Italian: "Italienisch", + Spanish: "Spanisch", + German: "Deutsch", + }, + es: { + recommended: "es recomendable", + translateVideo: "Traducir video", + disableTranslate: "Apagar", + translationSettings: "Ajustes de traducción", + resetSettings: "Restablecer ajustes", + videoBeingTranslated: "El video está siendo traducido", + videoLanguage: "Idioma del video", + translationLanguage: "Idioma de la traducción", + translationTake: "La traducción tardará", + translationTakeMoreThanHour: "La traducción tardará más de una hora", + translationTakeAboutMinute: + "La traducción tardará aproximadamente un minuto", + translationTakeFewMinutes: "La traducción tardará unos minutos", + translationTakeApproximatelyMinutes: + "La traducción tardará aproximadamente {0} minutos", + translationTakeApproximatelyMinute: + "La traducción tardará aproximadamente {0} minutos", + unSupportedExtensionError: `Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`, + requestTranslationFailed: "Error al solicitar la traducción de vídeo", + audioNotReceived: "Audiolink nicht empfangen", + grantPermissionToAutoPlay: "Conceder permiso de reproducción automática", + neededAdditionalExtension: + "Se necesita una extensión adicional para admitir este sitio", + audioFormatNotSupported: "El formato de audio no es compatible", + VOTAutoTranslate: "Traducir al abrir", + VOTDontTranslateYourLang: "No traduzca de su lengua", + VOTVolume: "Volumen de vídeo", + VOTVolumeTranslation: "Volumen de traducción", + VOTAutoSetVolume: "Reducir el volumen del video al ", + VOTShowVideoSlider: "Deslizador de volumen de video", + VOTSyncVolume: "Vincular el volumen de traducción y video", + VOTAudioProxy: "Proxificar el audio recibido", + VOTDisableFromYourLang: + "VOT: Ha desactivado la traducción del vídeo en su idioma", + VOTLiveNotSupported: + "VOT: No se admite la traducción de transmisiones en vivo", + VOTPremiere: "VOT: Espere a que termine el estreno antes de traducir", + VOTVideoIsTooLong: "VOT: El video es demasiado largo", + VOTNoVideoIDFound: "VOT: No se encontró id de video", + VOTFailedInitDB: "VOT: No se pudo inicializar la base de datos", + VOTDBNeedUpdate: + "VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página", + VOTDisabledForDBUpdating: `VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`, + VOTFailedWriteToDB: "VOT: No se pudo escribir datos en la base de datos", + VOTFailedReadFromDB: "VOT: No se pudo recuperar datos de la base de datos", + Russian: "Ruso", + English: "Inglés", + Chinese: "Chino", + French: "Francés", + Italian: "Italiano", + Spanish: "Español", + German: "Alemán", + }, + fr: { + recommended: "recommande", + translateVideo: "Traduire la vidéo", + disableTranslate: "Désactiver", + translationSettings: "Paramètres de traduction", + resetSettings: "Réinitialiser les paramètres", + videoBeingTranslated: "La vidéo est en cours de traduction", + videoLanguage: "Langue vidéo", + translationLanguage: "Langue cible", + translationTake: "La traduction prendra", + translationTakeMoreThanHour: "La traduction prendra plus d'une heure", + translationTakeAboutMinute: "La traduction prendra environ une minute", + translationTakeFewMinutes: "La traduction prendra quelques minutes", + translationTakeApproximatelyMinutes: + "La traduction prendra environ {0} minutes", + translationTakeApproximatelyMinute: + "La traduction prendra environ {0} minutes", + unSupportedExtensionError: `Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`, + requestTranslationFailed: + "Impossible de demander la traduction de la vidéo", + audioNotReceived: "Lien audio non reçu", + grantPermissionToAutoPlay: "Accorder l'autorisation de lecture automatique", + neededAdditionalExtension: + "Une extension supplémentaire est nécessaire pour prendre en charge ce site", + audioFormatNotSupported: "Format audio non pris en charge", + VOTAutoTranslate: "Traduire à l'ouverture", + VOTDontTranslateYourLang: "Ne pas traduire à partir de votre langue", + VOTVolume: "Volume de la vidéo", + VOTVolumeTranslation: "Volume de traduction", + VOTAutoSetVolume: "Réduire le volume de la vidéo à ", + VOTShowVideoSlider: "Curseur de volume vidéo", + VOTSyncVolume: "Lier le volume de la traduction et de la vidéo", + VOTAudioProxy: "Proxy audio reçu", + VOTDisableFromYourLang: + "VOT: Vous avez désactivé la traduction de la vidéo dans votre langue", + VOTLiveNotSupported: + "VOT: La traduction des flux en direct n'est pas prise en charge", + VOTPremiere: "VOT: Attendez la fin de la première avant de traduire", + VOTVideoIsTooLong: "VOT: La vidéo est trop longue", + VOTNoVideoIDFound: "VOT: ID vidéo introuvable", + VOTFailedInitDB: "VOT: Impossible d'initialiser la base de données", + VOTDBNeedUpdate: + "VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page", + VOTDisabledForDBUpdating: `VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`, + VOTFailedWriteToDB: + "VOT: Impossible d'écrire les données dans la base de données", + VOTFailedReadFromDB: + "VOT: Impossible de récupérer les données de la base de données", + Russian: "Russe", + English: "Anglais", + Chinese: "Chinois", + French: "Français", + Italian: "Italien", + Spanish: "Espagnol", + German: "Allemand", + }, + it: { + recommended: "è consigliabile", + translateVideo: "Traduci il video", + disableTranslate: "Spegnere", + translationSettings: "Impostazioni di traduzione", + resetSettings: "Ripristina impostazioni", + videoBeingTranslated: "Il video è in fase di traduzione", + videoLanguage: "Lingua Video", + translationLanguage: "Lingua di traduzione", + translationTake: "La traduzione richiederà", + translationTakeMoreThanHour: "La traduzione richiederà più di un'ora", + translationTakeAboutMinute: "La traduzione richiederà circa un minuto", + translationTakeFewMinutes: "La traduzione richiederà alcuni minuti", + translationTakeApproximatelyMinutes: + "La traduzione richiederà circa {0} minuti", + translationTakeApproximatelyMinute: + "La traduzione richiederà circa {0} minuti", + unSupportedExtensionError: `Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`, + requestTranslationFailed: "Richiesta di traduzione video non riuscita", + audioNotReceived: "Collegamento audio non ricevuto", + grantPermissionToAutoPlay: + "Concedere l'Autorizzazione per la riproduzione automatica", + neededAdditionalExtension: + "Per supportare questo sito è necessaria un'estensione aggiuntiva", + audioFormatNotSupported: "Il formato audio non è supportato", + VOTAutoTranslate: "Traduci all'apertura", + VOTDontTranslateYourLang: "Non traducete dalla vostra lingua", + VOTVolume: "Volume video", + VOTVolumeTranslation: "Volume di traduzione", + VOTAutoSetVolume: "Riduci il volume del video al ", + VOTShowVideoSlider: "Cursore del volume del video", + VOTSyncVolume: "Collega il volume della traduzione e del video", + VOTAudioProxy: "Proxy audio ricevuto", + VOTDisableFromYourLang: + "VOT: Avete disabilitato la traduzione del video nella vostra lingua", + VOTLiveNotSupported: + "VOT: La traduzione dei flussi dal vivo non è supportata", + VOTPremiere: "VOT: Aspetta che la prima finisca prima di tradurre", + VOTVideoIsTooLong: "VOT: Il video è troppo lungo", + VOTNoVideoIDFound: "VOT: ID video non trovato", + VOTFailedInitDB: "VOT: Impossibile inizializzare il database", + VOTDBNeedUpdate: + "VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina", + VOTDisabledForDBUpdating: `VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`, + VOTFailedWriteToDB: "VOT: Impossibile scrivere dati nel database", + VOTFailedReadFromDB: "VOT: Impossibile recuperare i dati dal database", + Russian: "Russo", + English: "Inglese", + Chinese: "Cinese", + French: "Francese", + Italian: "Italiano", + Spanish: "Spagnolo", + German: "Tedesco", + }, +}; + + + +;// CONCATENATED MODULE: ./src/utils/debug.js + + +const debug = {}; +debug.log = (...text) => { + if (true) { + return; + } + return console.log( + "%c[VOT DEBUG]", + "background: #F2452D; color: #fff; padding: 5px;", + ...text + ); +}; + +debug.translations = (testLang) => { + if (true) { + return; + } + // for add indexes + const testedTranslations = Object.entries(translations[testLang]).map( + ([key, value]) => ({ + phrase: key, + translated: value, + }) + ); + testedTranslations.unshift({ + phrase: "language_code (debug only)", + translated: testLang, + }); + return console.table(testedTranslations); +}; + +/* harmony default export */ const utils_debug = (debug); + +;// CONCATENATED MODULE: ./src/menu.js + + + +const userlang = navigator.language || navigator.userLanguage; +let lang = userlang.substr(0, 2).toLowerCase(); +if (!(lang in translations)) { + lang = "en"; +} + +function changeBtnColor(n) { + document.querySelector(".translationBtn").style.color = n; +} + +function changeBtnState(newState = "none") { + document.querySelector(".translationBtn").dataset.state = newState; +} + +function changeIconBackground(type = "none") { + let iconBackgroundColor; + switch (type) { + case "error": + iconBackgroundColor = "#7A7A7D"; + break; + case "success": + iconBackgroundColor = "#A36EFF"; + break; + default: + iconBackgroundColor = "#FFFFFF"; + break; + } + + document.querySelector(".translateIcon").style.fill = iconBackgroundColor; +} + +function transformBtn(type = "none", text) { + switch (type) { + case "error": + changeIconBackground(type); + changeBtnColor("#7A7A7D"); + changeBtnState(type); + break; + case "success": + changeIconBackground(type); + changeBtnColor("#A36EFF"); + changeBtnState(type); + break; + default: + changeIconBackground("none"); + changeBtnColor("#FFFFFF"); + changeBtnState("none"); + break; + } + + document.querySelector(".translationBtn").innerText = text; +} + +// Add translation buttton block +function addTranslationBlock(element) { + if (!element || element.querySelector(".translationBlock")) return; + + const block = document.createElement("div"); + block.classList.add("translationBlock"); + block.innerHTML = ` + + + + + + + ${translations[lang].translateVideo} + + + + + + + `; + + element.appendChild(block); + utils_debug.log("VOT: Added translation button to ", element); +} + +function createTranslationMenu() { + const container = document.createElement("div"); + container.classList.add("translationMenuContent"); + container.innerHTML = ` +

${translations[lang].translationSettings}

+
+
+ + + + + + +
+ `; + + container.onclick = (event) => event.stopPropagation(); + return container; +} + +// Create checkbox for menu +function createMenuCheckbox(id, valueToCheck, content) { + const checkboxContainer = document.createElement("div"); + const checkbox = document.createElement("input"); + const checkboxLabel = document.createElement("label"); + + checkbox.type = "checkbox"; + checkbox.id = id; + checkbox.checked = Boolean(valueToCheck); + + checkboxLabel.htmlFor = id; + checkboxLabel.innerHTML = content; + + checkboxContainer.classList.add("translationMenuContainer"); + checkboxContainer.appendChild(checkbox); + checkboxContainer.appendChild(checkboxLabel); + + return checkboxContainer; +} + +// Create slider for menu +function createMenuSlider(id, sliderValue, content) { + const sliderContainer = document.createElement("div"); + const slider = document.createElement("input"); + const sliderLabel = document.createElement("label"); + + slider.type = "range"; + slider.id = id; + slider.classList.add("VOTMenuSlider"); + slider.min = 0; + slider.max = 100; + slider.value = sliderValue; + + sliderLabel.htmlFor = id; + sliderLabel.classList.add("translationHeader"); + sliderLabel.innerHTML = content; + + sliderContainer.classList.add("translationMenuContainer"); + sliderContainer.appendChild(sliderLabel); + sliderContainer.appendChild(slider); + + return sliderContainer; +} + +// Create select for menu +function createMenuSelect(id, selectOptions) { + // selectOptions structure: + // [ + // { + // label: string, + // value: string, + // selected: boolean, + // disabled: boolean + // } + // ] + const selectContainer = document.createElement("div"); + const select = document.createElement("select"); + + select.id = id; + select.classList.add("VOTMenuSelect"); + + for (const option of selectOptions) { + const optionElement = document.createElement("option"); + optionElement.innerText = option.label; + optionElement.value = option.value; + if ( + Object.prototype.hasOwnProperty.call(option, "selected") && + option.selected + ) { + optionElement.setAttribute("selected", "selected"); + } + + if (Object.prototype.hasOwnProperty.call(option, "disabled")) { + optionElement.disabled = option.disabled; + } + + select.appendChild(optionElement); + } + + selectContainer.classList.add("translationMenuContainer"); + selectContainer.appendChild(select); + + return selectContainer; +} + + + +;// CONCATENATED MODULE: ./src/utils/utils.js + + + +if (!String.prototype.format) { + // https://stackoverflow.com/questions/610406/javascript-equivalent-to-printf-string-format + // syntax example: "is {0} function".format("format") + String.prototype.format = function () { + // store arguments in an array + var args = arguments; + // use replace to iterate over the string + // select the match and check if the related argument is present + // if yes, replace the match with the argument + return this.replace(/{(\d+)}/g, function (match, index) { + // check if the argument is present + return typeof args[index] != "undefined" ? args[index] : match; + }); + }; +} + +function waitForElm(selector) { + // https://stackoverflow.com/questions/5525071/how-to-wait-until-an-element-exists + return new Promise((resolve) => { + const element = document.querySelector(selector); + if (element) { + return resolve(element); + } + + const observer = new MutationObserver(() => { + const element = document.querySelector(selector); + if (element) { + resolve(element); + observer.disconnect(); + } + }); + + observer.observe(document.body, { + childList: true, + subtree: true, + once: true, + }); + }); +} + +const sleep = (m) => new Promise((r) => setTimeout(r, m)); + +const getVideoId = (service) => { + const url = new URL(window.location.href); + + switch (service) { + case "youtube": + return ( + url.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1] || + url.searchParams.get("v") + ); + case "vk": + if (url.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)) { + return url.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1); + } else if (url.searchParams.get("z")) { + return url.searchParams.get("z").split("/")[0]; + } else if (url.searchParams.get("oid") && url.searchParams.get("id")) { + return `video-${Math.abs( + url.searchParams.get("oid") + )}_${url.searchParams.get("id")}`; + } else { + return false; + } + case "9gag": + case "gag": + return url.pathname.match(/gag\/([^/]+)/)?.[1]; + case "twitch": + if (/^m\.twitch\.tv$/.test(window.location.hostname)) { + const linkUrl = document.head.querySelector('link[rel="canonical"]'); + return ( + linkUrl?.href.match(/videos\/([^/]+)/)?.[0] || url.pathname.slice(1) + ); + } else if (/^player\.twitch\.tv$/.test(window.location.hostname)) { + return `videos/${url.searchParams.get("video")}`; + } else if (/^clips\.twitch\.tv$/.test(window.location.hostname)) { + // get link to twitch channel (ex.: https://www.twitch.tv/xqc) + const channelLink = document.querySelector( + ".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']" + ); + if (!channelLink) { + return false; + } + + const channelName = channelLink.href.replace( + "https://www.twitch.tv/", + "" + ); + return `${channelName}/clip/${url.searchParams.get("clip")}`; + } else if (url.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)) { + return url.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]; + } else { + return url.pathname.match(/(?:videos)\/([^/]+)/)?.[0]; + } + case "tiktok": + return url.pathname.match(/video\/([^/]+)/)?.[1]; + case "vimeo": + return ( + url.pathname.match(/[^/]+\/[^/]+$/)?.[0] || + url.pathname.match(/[^/]+$/)?.[0] + ); + case "xvideos": + return url.pathname.match(/[^/]+\/[^/]+$/)?.[0]; + case "pornhub": + return ( + url.searchParams.get("viewkey") || + url.pathname.match(/embed\/([^/]+)/)?.[1] + ); + case "twitter": + return url.pathname.match(/status\/([^/]+)/)?.[1]; + case "udemy": + return url.pathname; + case "facebook": + return url.pathname; + case "rutube": + return url.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1]; + case "coub": + return url.pathname.match(/view\/([^/]+)/)?.[1]; + case "bilibili.com": + const bvid = url.searchParams.get("bvid"); + if (bvid) { + return bvid; + } else { + let vid = url.pathname.match(/video\/([^/]+)/)?.[1]; + if (vid && url.search && url.searchParams.get("p") !== null) { + vid += `/?p=${url.searchParams.get("p")}`; + } + return vid; + } + case "mail.ru": + if (url.pathname.startsWith("/v/") || url.pathname.startsWith("/mail/")) { + return url.pathname; + } else if (url.pathname.match(/video\/embed\/([^/]+)/)) { + const referer = document.querySelector( + ".b-video-controls__mymail-link" + ); + if (!referer) { + return false; + } + + return referer?.href.split("my.mail.ru")?.[1]; + } + default: + return false; + } +}; + +function secsToStrTime(secs) { + const minutes = Math.floor(secs / 60); + const seconds = Math.floor(secs % 60); + if (minutes >= 60) { + return translations[lang].translationTakeMoreThanHour; + } else if (minutes >= 10 && minutes % 10) { + return translations[lang].translationTakeApproximatelyMinutes.format( + minutes + ); + } else if (minutes == 1 || (minutes == 0 && seconds > 0)) { + return translations[lang].translationTakeAboutMinute; + } else { + return translations[lang].translationTakeApproximatelyMinute.format( + minutes + ); + } +} + + + +// EXTERNAL MODULE: ./src/config/config.js +var config = __webpack_require__("./src/config/config.js"); +;// CONCATENATED MODULE: ./src/config/alternativeUrls.js +// Sites host Invidious. I tested the performance only on invidious.kevin.rocks, youtu.be and inv.vern.cc +const sitesInvidious = [ + "invidious.snopyta.org", + "yewtu.be", + "invidious.kavin.rocks", + "vid.puffyan.us", + "invidious.namazso.eu", + "inv.riverside.rocks", + "yt.artemislena.eu", + "invidious.flokinet.to", + "invidious.esmailelbob.xyz", + "y.com.sb", + "invidious.nerdvpn.de", + "inv.vern.cc", + "invidious.slipfox.xyz", + "invidio.xamh.de", + "invidious.dhusch.de", +]; + +// Sites host Piped. I tested the performance only on piped.video +const sitesPiped = [ + "piped.video", + "piped.tokhmi.xyz", + "piped.moomoo.me", + "piped.syncpundit.io", + "piped.mha.fi", + "watch.whatever.social", + "piped.garudalinux.org", + "efy.piped.pages.dev", + "watch.leptons.xyz", + "piped.lunar.icu", + "yt.dc09.ru", + "piped.mint.lgbt", + "il.ax", + "piped.privacy.com.de", + "piped.esmailelbob.xyz", + "piped.projectsegfau.lt", + "piped.in.projectsegfau.lt", + "piped.us.projectsegfau.lt", + "piped.privacydev.net", + "piped.palveluntarjoaja.eu", + "piped.smnz.de", + "piped.adminforge.de", + "piped.qdi.fi", + "piped.hostux.net", + "piped.chauvet.pro", + "piped.jotoma.de", + "piped.pfcd.me", + "piped.frontendfriendly.xyz", +]; + + + +;// CONCATENATED MODULE: ./src/indexedDB.js + + + +// --- IndexedDB functions start: +const dbVersion = 2; // current db version +const settingsDefault = { + key: "settings", + autoTranslate: 0, + defaultVolume: 100, + showVideoSlider: 0, + syncVolume: 0, + autoSetVolumeYandexStyle: 1, + dontTranslateYourLang: 1, +}; // default settings for db v1 + +const valuesV2 = { + audioProxy: 0, +}; + +function openDB(name) { + return indexedDB.open(name, dbVersion); +} + +async function initDB() { + return new Promise((resolve, reject) => { + function updateVersionProccessor( + transaction, + db, + indexes, + previousIndexes = {} + ) { + // openRequest is transaction object + // indexes is object of strings with default values (used for createIndex) ex. {"name": 0} + // previousIndexes is indexes for previous version + const objectStore = transaction.objectStore("settings"); + + for (const key of Object.keys(indexes)) { + objectStore.createIndex(key, key, { unique: false }); + } + + console.log("VOT: The database has been updated"); + objectStore.transaction.oncomplete = (event) => { + const objectStore = db + .transaction("settings", "readwrite") + .objectStore("settings"); + const request = objectStore.get("settings"); + + request.onerror = (event) => { + console.error( + "VOT: Data could not be retrieved from the Database: ", + event.error + ); + reject(false); + }; + + request.onsuccess = () => { + const data = + request.result || Object.assign(settingsDefault, previousIndexes); // use data from db or reset all data + for (const key in indexes) { + data[key] = indexes[key]; + } + + const requestUpdate = objectStore.put(data); + + requestUpdate.onerror = (event) => { + console.error( + "VOT: Failed to update the Database to new version", + event.error + ); + reject(false); + }; + + requestUpdate.onsuccess = () => { + console.log( + "VOT: Standard settings of the new version have been added to the Database." + ); + resolve(true); + }; + }; + }; + } + + const openRequest = openDB("VOT"); + + openRequest.onerror = () => { + console.error( + `${translations[lang].VOTFailedInitDB}: ${openRequest.error.message}` + ); + reject(false); + }; + + openRequest.onupgradeneeded = (event) => { + const db = openRequest.result; + + db.onerror = () => { + const errorMessage = translations[lang].VOTFailedInitDB; + alert(errorMessage); + console.error(errorMessage, openRequest.error); + reject(false); + }; + + if (event.oldVersion < 1) { + // db not found + const objectStore = db.createObjectStore("settings", { + keyPath: "key", + }); + + // add indexes for 1 version (without key index) + for (const key of Object.keys(settingsDefault).filter( + (k) => k !== "key" + )) { + objectStore.createIndex(key, key, { unique: false }); + } + + console.log("VOT: Database Created"); + + objectStore.transaction.oncomplete = (event) => { + const objectStore = db + .transaction("settings", "readwrite") + .objectStore("settings"); + const request = objectStore.add(settingsDefault); + + request.onsuccess = () => { + console.log( + "VOT: Standard settings added to the Database: ", + request.result + ); + resolve(true); + }; + + request.onerror = () => { + console.log( + "VOT: Error when adding standard settings to the Database: ", + request.error + ); + reject(false); + }; + }; + } + + if (event.oldVersion < 2) { + // db is outdated (db version is 1) + updateVersionProccessor(openRequest.transaction, db, valuesV2); + } + }; + + openRequest.onsuccess = () => { + const db = openRequest.result; + db.onversionchange = () => { + db.close(); + const errorMessage = translations[lang].VOTDBNeedUpdate; + alert(errorMessage); + console.log(errorMessage); + window.location.reload(); + reject(false); + }; + resolve(true); + }; + + openRequest.onblocked = () => { + const db = openRequest.result; + const errorMessage = translations[lang].VOTDisabledForDBUpdating; + console.error(errorMessage, db); + alert(errorMessage); + reject(false); + }; + }); +} + +async function updateDB({ + autoTranslate, + defaultVolume, + showVideoSlider, + syncVolume, + autoSetVolumeYandexStyle, + dontTranslateYourLang, + audioProxy, +}) { + return new Promise((resolve, reject) => { + if ( + typeof autoTranslate === "number" || + typeof defaultVolume === "number" || + typeof showVideoSlider === "number" || + typeof syncVolume === "number" || + typeof autoSetVolumeYandexStyle === "number" || + typeof dontTranslateYourLang === "number" || + typeof audioProxy === "number" + ) { + const openRequest = openDB("VOT"); + + openRequest.onerror = () => { + const errorMessage = translations[lang].VOTFailedWriteToDB; + alert(errorMessage); + console.error(errorMessage, openRequest.error.message); + reject(false); + }; + + openRequest.onupgradeneeded = async () => { + const db = openRequest.result; + db.close(); + await initDB(); + resolve(true); + }; + + openRequest.onsuccess = () => { + const db = openRequest.result; + db.onversionchange = () => { + db.close(); + console.log( + "VOT: The database needs an update, please reload the page if it didn't happen automatically" + ); + window.location.reload(); + reject(false); + }; + + const objectStore = db + .transaction("settings", "readwrite") + .objectStore("settings"); + const request = objectStore.get("settings"); + + request.onerror = (event) => { + console.error( + "VOT: Data could not be retrieved from the Database: ", + event.error + ); + reject(false); + }; + + request.onsuccess = () => { + const data = request.result; + + if (typeof autoTranslate === "number") { + data.autoTranslate = autoTranslate; + } + + if (typeof defaultVolume === "number") { + data.defaultVolume = defaultVolume; + } + + if (typeof showVideoSlider === "number") { + data.showVideoSlider = showVideoSlider; + } + + if (typeof syncVolume === "number") { + data.syncVolume = syncVolume; + } + + if (typeof autoSetVolumeYandexStyle === "number") { + data.autoSetVolumeYandexStyle = autoSetVolumeYandexStyle; + } + + if (typeof dontTranslateYourLang === "number") { + data.dontTranslateYourLang = dontTranslateYourLang; + } + + if (typeof audioProxy === "number") { + data.audioProxy = audioProxy; + } + + const requestUpdate = objectStore.put(data); + + requestUpdate.onerror = (event) => { + console.error( + "VOT: Не удалось обновить данные в Базе Данных: ", + event.error + ); + reject(false); + }; + + requestUpdate.onsuccess = () => { + resolve(true); + }; + }; + }; + + openRequest.onblocked = () => { + const db = openRequest.result; + const errorMessage = translations[lang].VOTDisabledForDBUpdating; + console.error(errorMessage, db); + alert(errorMessage); + reject(false); + }; + } + }); +} + +async function readDB() { + return new Promise((resolve, reject) => { + const openRequest = openDB("VOT"); + + openRequest.onerror = () => { + const errorMessage = translations[lang].VOTFailedReadFromDB; + alert(errorMessage); + console.error(errorMessage, openRequest.error.message); + reject(false); + }; + + openRequest.onupgradeneeded = async () => { + const db = openRequest.result; + db.close(); + await initDB(); + resolve(true); + }; + + openRequest.onsuccess = () => { + const db = openRequest.result; + db.onversionchange = () => { + db.close(); + const errorMessage = translations[lang].VOTDBNeedUpdate; + alert(errorMessage); + console.error(errorMessage); + reject(false); + }; + + const objectStore = db.transaction("settings").objectStore("settings"); + const request = objectStore.get("settings"); + + request.onerror = (event) => { + console.error(translations[lang].VOTFailedReadFromDB, event.error); + console.error(event); + reject(false); + }; + + request.onsuccess = () => { + if (request.result === undefined) { + db.close(); + deleteDB(); + reject(false); + } + const data = request.result; + resolve(data); + }; + }; + + openRequest.onblocked = () => { + const db = openRequest.result; + const errorMessage = translations[lang].VOTDisabledForDBUpdating; + console.error(errorMessage, db); + alert(errorMessage); + reject(false); + }; + }); +} + +function deleteDB() { + indexedDB.deleteDatabase("VOT"); +} + + + +;// CONCATENATED MODULE: ./src/utils/volume.js +// element - audio / video element +function syncVolume(element, sliderVolume, otherSliderVolume, tempVolume) { + let finalValue; + if (sliderVolume > tempVolume) { + // sliderVolume = 100 + // tempVolume = 69 + // volume = 15 + // 100 - 69 = 31 + // 15 + 31 = 46 - final video volume + finalValue = otherSliderVolume + (sliderVolume - tempVolume); + finalValue = finalValue > 100 ? 100 : Math.max(finalValue, 0); + + element.volume = finalValue / 100; + } else if (sliderVolume < tempVolume) { + // sliderVolume = 69 + // tempVolume = 100 + // volume = 15 + // 100 - 69 = 31 + // 15 - 31 = 0 - final video volume + finalValue = otherSliderVolume - (tempVolume - sliderVolume); + finalValue = finalValue > 100 ? 100 : Math.max(finalValue, 0); + + element.volume = finalValue / 100; + } + + return finalValue; +} + + + +;// CONCATENATED MODULE: ./src/config/regexes.js +const regexes = () => { + return { + youtubeRegex: /^(www.|m.)?youtube(-nocookie)?.com$/, + }; +}; + +/* harmony default export */ const config_regexes = (regexes()); + +;// CONCATENATED MODULE: ./src/config/selectors.js +const selectors = () => { + return { + youtubeSelector: ".html5-video-container", + twitchSelector: ".video-ref", + twitchMobileSelector: "main > div > section > div > div > div", + pipedSelector: ".shaka-video-container", + vkSelector: ".videoplayer_media", + twitterSelector: + 'div[data-testid="videoComponent"] > div:nth-child(1) > div', + vimeoSelector: ".player", + gagSelector: ".video-post", + bilibilicomSelector: ".bpx-player-video-wrap", + mailSelector: "#b-video-wrapper", + }; +}; + +/* harmony default export */ const config_selectors = (selectors()); + +;// CONCATENATED MODULE: ./src/index.js + + + + + + + + + + + + + + + +const sitesChromiumBlocked = [...sitesInvidious, ...sitesPiped]; + +// translate properties +let translateFromLang = "en"; // default language of video + +let translateToLang = "ru"; // default language of audio response + +let ytData = ""; + +async function src_main() { + utils_debug.log("Loading extension..."); + utils_debug.log(`Selected menu language: ${lang}`); + // test all translations in console + // debug.translations('ru'); + // debug.translations('en'); + // debug.translations('de'); + // debug.translations('zh'); + // debug.translations('es'); + // debug.translations('fr'); + // debug.translations('it'); + + const rvt = await Promise.resolve(/* import() */).then(__webpack_require__.bind(__webpack_require__, "./src/rvt.js")); + + const requestVideoTranslation = rvt.default; + + utils_debug.log("Inited requestVideoTranslation..."); + + if ( + true && + GM_info?.scriptHandler && + ["Violentmonkey", "FireMonkey", "Greasemonkey", "AdGuard"].includes( + GM_info.scriptHandler + ) + ) { + const errorText = translations[lang].unSupportedExtensionError; + console.error(errorText); + return alert(errorText); + } + + utils_debug.log("Extension compatibility passed..."); + + let timer; + const audio = new Audio(); + let opacityRatio = 0.9; + let openedMenu = false; + + if (false) { var translationPanding; } + + function logout(n) { + if (openedMenu) return; + + document.querySelector(".translationBlock").style.opacity = n; + } + + function resetTimer() { + clearTimeout(timer); + logout(1); + timer = setTimeout(() => { + logout(0); + }, 2000); + } + + function changeOpacityOnEvent(event, timer, opacityRatio) { + clearTimeout(timer); + logout(opacityRatio); + event.stopPropagation(); + } + + const deleteAudioSrc = () => { + audio.src = ""; + audio.removeAttribute("src"); + }; + + // Add menu container + function addTranslationMenu(element) { + if (element.querySelector(".translationMenuContent")) return; + + const container = createTranslationMenu(); + element.appendChild(container); + + // click to translation menu icon + document + .querySelector(".translationMenu") + ?.addEventListener("click", (event) => { + event.stopPropagation(); + const content = document.querySelector(".translationMenuContent"); + content.style.display = openedMenu ? "none" : "block"; + content.style.opacity = opacityRatio; + openedMenu = !openedMenu; + }); + + document + .querySelector(".translationDropDB") + .addEventListener("click", (event) => { + event.stopPropagation(); + deleteDB(); + location.reload(); + }); + + utils_debug.log("VOT: Added translation menu to ", element); + } + + function translateVideo(url, unknown1, requestLang, responseLang, callback) { + utils_debug.log( + `Translate video (url: ${url}, unknown1: ${unknown1}, requestLang: ${requestLang}, responseLang: ${responseLang})` + ); + + if (false) {} + + translationPanding = true; + + requestVideoTranslation( + url, + unknown1, + requestLang, + responseLang, + (success, response) => { + translationPanding = false; + + utils_debug.log("[exec callback] Requesting video translation"); + if (!success) { + callback(false, translations[lang].requestTranslationFailed); + return; + } + + const translateResponse = yandexRequests/* yandexRequests */.G.decodeResponse(response); + console.log("VOT Response: ", translateResponse); + + switch (translateResponse.status) { + case 0: + callback(false, translateResponse.message); + break; + case 1: + callback( + !!translateResponse.url, + translateResponse.url || translations[lang].audioNotReceived + ); + break; + case 2: + callback( + false, + translateResponse.remainingTime + ? secsToStrTime(translateResponse.remainingTime) + : translations[lang].translationTakeFewMinutes + ); + break; + case 3: + /* + Иногда, в ответе приходит статус код 3, но видео всё, так же, ожидает перевода. В конечном итоге, это занимает слишком много времени, + как-будто сервер не понимает, что данное видео уже недавно было переведено и заместо возвращения готовой ссылки на перевод начинает переводить видео заново при чём у него это получается за очень длительное время + */ + callback(false, translations[lang].videoBeingTranslated); + break; + } + } + ); + } + + async function translateProccessor(videoContainer, siteHostname, siteEvent) { + utils_debug.log("[translateProccessor] execute on element: ", videoContainer); + + let video; + let autoRetry; + let volumeOnStart; + let tempOriginalVolume; + let tempVolume; + let dbAutoTranslate; + let dbDefaultVolume; + let dbShowVideoSlider; + let dbAutoSetVolumeYandexStyle; + let dontTranslateYourLang; + let dbSyncVolume; + let dbAudioProxy; // cf version only + let firstPlay = true; + let isDBInited; + + utils_debug.log("videoContainer", videoContainer); + + video = + siteHostname === "vimeo" + ? videoContainer.querySelector( + ".vp-video-wrapper > .vp-video > .vp-telecine > video" + ) + : videoContainer.querySelector("video"); + + utils_debug.log("video", video); + + let videoData = await getVideoData(); + console.log("VOT Video Data: ", videoData); + + const container = + siteHostname === "pornhub" && + window.location.pathname.includes("view_video.php") + ? document.querySelector(".original.mainPlayerDiv") + : siteHostname === "pornhub" && + window.location.pathname.includes("embed/") + ? document.querySelector("body") + : window.location.hostname.includes("m.youtube.com") + ? document.querySelector("#player-control-container") + : videoContainer; + + addTranslationBlock(container); + addTranslationMenu(container); + + try { + isDBInited = await initDB(); + } catch (err) { + console.error( + "[VOT] Failed to initialize database settings. All changes made will not be saved", + err + ); + } + + const menuOptions = document.querySelector(".translationMenuOptions"); + if (menuOptions && !menuOptions.querySelector("#VOTTranslateFromLang")) { + const selectFromLangOptions = [ + { + label: translations[lang].videoLanguage, + value: "default", + disabled: true, + }, + ...Object.entries(availableLangs).map(([key, value]) => ({ + label: translations[lang][value], + value: key, + selected: videoData.detectedLanguage === key, + })), + ]; + + const selectToLangOptions = [ + { + label: translations[lang].translationLanguage, + value: "default", + disabled: true, + }, + ...Object.entries(availableLangs).map(([key, value]) => ({ + label: translations[lang][value], + value: key, + selected: videoData.responseLanguage === key, + })), + ]; + + const selectFromLang = createMenuSelect( + "VOTTranslateFromLang", + selectFromLangOptions + ); + + const selectToLang = createMenuSelect( + "VOTTranslateToLang", + selectToLangOptions + ).firstElementChild; + + selectFromLang.id = "VOTSelectLanguages"; + selectFromLang.innerHTML += ` + + + + `; + + selectFromLang.appendChild(selectToLang); + menuOptions.appendChild(selectFromLang); + + menuOptions + .querySelector("#VOTTranslateFromLang") + .addEventListener("change", async (event) => { + utils_debug.log("[onchange] select from language", event.target.value); + videoData = await setDetectedLangauge(videoData, event.target.value); + }); + + menuOptions + .querySelector("#VOTTranslateToLang") + .addEventListener("change", async (event) => { + utils_debug.log("[onchange] select to language", event.target.value); + videoData = await setResponseLangauge(videoData, event.target.value); + }); + } + + if (isDBInited) { + const dbData = await readDB(); + if (dbData) { + dbAutoTranslate = dbData.autoTranslate; + dbDefaultVolume = dbData.defaultVolume; + dbShowVideoSlider = dbData.showVideoSlider; + dbAutoSetVolumeYandexStyle = dbData.autoSetVolumeYandexStyle; + dontTranslateYourLang = dbData.dontTranslateYourLang; + dbAudioProxy = dbData.audioProxy; // cf version only + dbSyncVolume = dbData.syncVolume; // youtube only + + utils_debug.log("[db] data from db: ", dbData); + + if ( + dbAutoTranslate !== undefined && + menuOptions && + !menuOptions.querySelector("#VOTAutoTranslate") + ) { + const checkbox = createMenuCheckbox( + "VOTAutoTranslate", + dbAutoTranslate, + translations[lang].VOTAutoTranslate + + (siteHostname === "vk" || + window.location.hostname.includes("m.twitch.tv") + ? ` (${translations[lang].recommended})` + : "") + ); + + checkbox.querySelector("#VOTAutoTranslate").onclick = async ( + event + ) => { + event.stopPropagation(); + const value = Number(event.target.checked); + await updateDB({ autoTranslate: value }); + dbAutoTranslate = value; + utils_debug.log( + "autoTranslate value changed. New value: ", + dbAutoTranslate + ); + }; + + menuOptions.appendChild(checkbox); + } + + if ( + window.location.hostname.includes("youtube.com") && + dontTranslateYourLang !== undefined && + menuOptions && + !menuOptions.querySelector("#VOTDontTranslateYourLang") + ) { + const checkbox = createMenuCheckbox( + "VOTDontTranslateYourLang", + dontTranslateYourLang, + translations[lang].VOTDontTranslateYourLang + ); + + checkbox.querySelector("#VOTDontTranslateYourLang").onclick = async ( + event + ) => { + event.stopPropagation(); + const value = Number(event.target.checked); + await updateDB({ dontTranslateYourLang: value }); + dontTranslateYourLang = value; + utils_debug.log( + "dontTranslateYourLang value changed. New value: ", + dontTranslateYourLang + ); + }; + + menuOptions.appendChild(checkbox); + } + + if ( + dbAutoSetVolumeYandexStyle !== undefined && + menuOptions && + !menuOptions.querySelector("#VOTAutoSetVolume") + ) { + const checkbox = createMenuCheckbox( + "VOTAutoSetVolume", + dbAutoSetVolumeYandexStyle, + translations[lang].VOTAutoSetVolume + `${config/* autoVolume */.IM * 100}%` + ); + + checkbox.querySelector("#VOTAutoSetVolume").onclick = async ( + event + ) => { + event.stopPropagation(); + const value = Number(event.target.checked); + await updateDB({ autoSetVolumeYandexStyle: value }); + dbAutoSetVolumeYandexStyle = value; + utils_debug.log( + "autoSetVolumeYandexStyle value changed. New value: ", + dbAutoSetVolumeYandexStyle + ); + }; + + menuOptions.appendChild(checkbox); + } + + if ( + dbShowVideoSlider !== undefined && + menuOptions && + !menuOptions.querySelector("#VOTShowVideoSlider") + ) { + const checkbox = createMenuCheckbox( + "VOTShowVideoSlider", + dbShowVideoSlider, + translations[lang].VOTShowVideoSlider + ); + + checkbox.querySelector("#VOTShowVideoSlider").onclick = async ( + event + ) => { + event.stopPropagation(); + const value = Number(event.target.checked); + await updateDB({ showVideoSlider: value }); + dbShowVideoSlider = value; + utils_debug.log( + "showVideoSlider value changed. New value: ", + dbShowVideoSlider + ); + if ( + dbShowVideoSlider === 1 && + document.querySelector(".translationBtn").dataset.state === + "success" + ) { + addVideoSlider(); + } else { + document.querySelector("#VOTVideoSlider")?.parentElement.remove(); + } + }; + + menuOptions.appendChild(checkbox); + } + + if ( + window.location.hostname.includes("youtube.com") && + !window.location.hostname.includes("m.youtube.com") && + dbSyncVolume !== undefined && + menuOptions && + !menuOptions.querySelector("#VOTSyncVolume") + ) { + const checkbox = createMenuCheckbox( + "VOTSyncVolume", + dbSyncVolume, + translations[lang].VOTSyncVolume + ); + + checkbox.querySelector("#VOTSyncVolume").onclick = async (event) => { + event.stopPropagation(); + const value = Number(event.target.checked); + await updateDB({ syncVolume: value }); + dbSyncVolume = value; + utils_debug.log("syncVolume value changed. New value: ", dbSyncVolume); + }; + + menuOptions.appendChild(checkbox); + } + + // cf version only + if ( + false + ) {} + } + } + + transformBtn("none", translations[lang].translateVideo); + + if ( + window.location.hostname.includes("youtube.com") && + !window.location.hostname.includes("m.youtube.com") + ) { + const syncVolumeObserver = new MutationObserver(async function ( + mutations + ) { + mutations.forEach(async function (mutation) { + if ( + mutation.type === "attributes" && + mutation.attributeName === "aria-valuenow" && + document.querySelector("#VOTVideoSlider") + ) { + syncVideoVolumeSlider(); + } + }); + }); + + syncVolumeObserver.observe(document.querySelector(".ytp-volume-panel"), { + attributes: true, + childList: false, + subtree: true, + attributeOldValue: true, + }); + } + + function setSelectMenuValues(from, to = lang) { + if (!document.querySelector("#VOTSelectLanguages")) { + return; + } + console.log(`Set translation from ${from} to ${to}`); + document.querySelector("#VOTTranslateFromLang").value = from; + document.querySelector("#VOTTranslateToLang").value = to; + } + + // data - ytData or VideoData + async function setDetectedLangauge(data, videolang) { + switch (videolang) { + case "en": + data.detectedLanguage = videolang; + data.responseLanguage = lang; + break; + case "ru": + data.detectedLanguage = videolang; + data.responseLanguage = lang; + if (lang == "ru") data.responseLanguage = "en"; + break; + default: + if (!Object.keys(availableLangs).includes(videolang)) { + return setDetectedLangauge(data, "en"); + } + + data.detectedLanguage = videolang; + } + + setSelectMenuValues(data.detectedLanguage, data.responseLanguage); + + return data; + } + + // data - ytData or VideoData + async function setResponseLangauge(data, videolang) { + switch (videolang) { + case "en": + data.responseLanguage = videolang; + data.detectedLanguage = "ru"; + break; + default: + if (!Object.keys(availableLangs).includes(videolang)) { + return setResponseLangauge(data, "ru"); + } + + if (data.detectedLanguage && data.responseLanguage === lang) { + data.detectedLanguage = "en"; + } + + data.responseLanguage = videolang; + } + + setSelectMenuValues(data.detectedLanguage, data.responseLanguage); + + return data; + } + + function stopTraslate() { + // Default actions on stop translate + audio.pause(); + video.removeEventListener(".translate", stopTraslate, false); + deleteAudioSrc(); + document.querySelector("#VOTVideoSlider")?.parentElement.remove(); + document.querySelector("#VOTTranslationSlider")?.parentElement.remove(); + const downloadBtn = document.querySelector(".translationDownload"); + downloadBtn.href = ""; + downloadBtn.style.display = "none"; + transformBtn("none", translations[lang].translateVideo); + if (volumeOnStart) { + video.volume = volumeOnStart; + } + } + + function syncVideoVolumeSlider() { + // Sync volume slider with original video (youtube only) + const newSlidersVolume = document + .querySelector(".ytp-volume-panel") + .getAttribute("aria-valuenow"); + + const videoSlider = document.querySelector("#VOTVideoSlider"); + + if (!videoSlider) { + return; + } + videoSlider.value = newSlidersVolume; + + const videoVolumeLabel = document.querySelector("#VOTVideoVolume"); + + if (videoVolumeLabel) { + videoVolumeLabel.innerText = `${newSlidersVolume}%`; + } + + if (dbSyncVolume === 1) { + tempOriginalVolume = Number(newSlidersVolume); + } + } + + async function getVideoData() { + const videoData = {}; + + videoData.duration = video?.duration || 0; + + videoData.videoId = getVideoId(siteHostname); + + videoData.detectedLanguage = translateFromLang; + + videoData.responseLanguage = translateToLang; + + if (window.location.hostname.includes("youtube.com")) { + ytData = await getYTVideoData(); + ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); + videoData.detectedLanguage = ytData.detectedLanguage; + videoData.responseLanguage = ytData.responseLanguage; + } else if ( + window.location.hostname.includes("rutube") || + window.location.hostname.includes("my.mail.ru") + ) { + videoData.detectedLanguage = "ru"; + videoData.responseLanguage = "en"; + } else if (window.location.hostname.includes("bilibili.com")) { + videoData.detectedLanguage = "zh"; + } + + return videoData; + } + + const lipSync = (mode = false) => { + utils_debug.log("lipsync video", video); + if (!video) { + return; + } + audio.currentTime = video.currentTime; + audio.playbackRate = video.playbackRate; + + if (!mode) { + utils_debug.log("lipsync mode is not set"); + return; + } + + if (mode === "play") { + utils_debug.log("lipsync mode is play"); + const audioPromise = audio.play(); + if (audioPromise !== undefined) { + audioPromise.catch((e) => { + console.error(e); + if (e.name === "NotAllowedError") { + const errorMessage = translations[lang].grantPermissionToAutoPlay; + transformBtn("error", errorMessage); + throw `VOT: ${errorMessage}`; + } else if (e.name === "NotSupportedError") { + const errorMessage = sitesChromiumBlocked.includes( + window.location.hostname + ) + ? translations[lang].neededAdditionalExtension + : translations[lang].audioFormatNotSupported; + transformBtn("error", errorMessage); + throw `VOT: ${errorMessage}`; + } + }); + } + return; + } + if (mode === "pause" || "stop" || 0 || 0) { + utils_debug.log(`lipsync mode is ${mode}`); + audio.pause(); + } + if (mode === "playing") { + utils_debug.log("lipsync mode is playing"); + audio.play(); + } + }; + + function addVideoSlider() { + if ( + dbShowVideoSlider !== 1 || + document.querySelector("#VOTVideoSlider") || + document.querySelector(".translationBtn").dataset.state !== "success" + ) { + return; + } + + const newVolume = + window.location.hostname.includes("youtube.com") && + !dbAutoSetVolumeYandexStyle + ? document + .querySelector(".ytp-volume-panel") + ?.getAttribute("aria-valuenow") + : Math.round(video.volume * 100); + tempOriginalVolume = newVolume; + + const slider = createMenuSlider( + "VOTVideoSlider", + newVolume, + `${translations[lang].VOTVolume}: ${newVolume}%` + ); + + slider.querySelector("#VOTVideoSlider").oninput = (event) => { + const { value } = event.target; + video.volume = value / 100; + slider.querySelector("#VOTOriginalVolume").innerText = `${value}%`; + + if (dbSyncVolume !== 1) { + return; + } + + // Sync translation volume slider with video volume slider + const translateVolumeSlider = document.querySelector( + "#VOTTranslationSlider" + ); + + if (!translateVolumeSlider) { + return; + } + const translateVolume = Number(translateVolumeSlider.value); + const finalValue = syncVolume( + audio, + value, + translateVolume, + tempOriginalVolume + ); + + translateVolumeSlider.value = finalValue; + + const translateVolumeLabel = document.querySelector( + "#VOTTranslationVolume" + ); + + if (translateVolumeLabel) { + translateVolumeLabel.innerText = `${finalValue}%`; + } + + tempVolume = finalValue; + tempOriginalVolume = value; + }; + + const menuOptions = document.querySelector(".translationMenuOptions"); + menuOptions.appendChild(slider); + } + + function addTranslationSlider() { + // Return early if slider already exists or translation is not successful + if ( + document.querySelector("#VOTTranslationSlider") || + document.querySelector(".translationBtn").dataset.state !== "success" + ) { + return; + } + + // Use dbDefaultVolume or 100 as the default translation volume + const defaultTranslateVolume = + typeof dbDefaultVolume === "number" ? dbDefaultVolume : 100; + tempOriginalVolume = defaultTranslateVolume; + + // Create a slider element with the default volume and label + const slider = createMenuSlider( + "VOTTranslationSlider", + defaultTranslateVolume, + `${translations[lang].VOTVolumeTranslation}: ${defaultTranslateVolume}%` + ); + + // Add an input event listener to the slider + slider.querySelector("#VOTTranslationSlider").oninput = async ({ + target: { value }, + }) => { + // Set the audio volume to the slider value + audio.volume = value / 100; + + // Update the volume label + document.querySelector("#VOTTranslationVolume").innerText = `${value}%`; + + // Update the database with the new volume value + await updateDB({ defaultVolume: Number(value) }); + dbDefaultVolume = Number(value); + + // Sync translation volume with video volume if dbSyncVolume is 1 + if (dbSyncVolume === 1) { + syncTranslationWithVideo(value); + } + }; + + // Append the slider to the menu options + const menuOptions = document.querySelector(".translationMenuOptions"); + menuOptions.appendChild(slider); + } + + // A helper function to sync translation volume with video volume + function syncTranslationWithVideo(translationValue) { + // Get the video volume slider element + const videoVolumeSlider = document.querySelector("#VOTVideoSlider"); + + if (!videoVolumeSlider) { + return; + } + // Get the video volume value + const videoVolume = Number(videoVolumeSlider.value); + + // Calculate the synced video volume based on the translation volume + const finalValue = syncVolume( + video, + translationValue, + videoVolume, + tempVolume + ); + + // Set the video volume slider value to the synced value + videoVolumeSlider.value = finalValue; + + // Update the video volume label + const videoVolumeLabel = document.querySelector("#VOTOriginalVolume"); + if (videoVolumeLabel) videoVolumeLabel.innerText = `${finalValue}%`; + + // Update the temp variables for future syncing + tempOriginalVolume = finalValue; + tempVolume = translationValue; + } + + async function videoValidator() { + if (window.location.hostname.includes("youtube.com")) { + ytData = setDetectedLangauge(ytData, ytData.detectedLanguage); + utils_debug.log("VideoValidator videoData: ", videoData); + if (dontTranslateYourLang === 1 && ytData.detectedLanguage === lang) { + firstPlay = false; + throw translations[lang].VOTDisableFromYourLang; + } + + if (ytData.isLive) { + throw translations[lang].VOTLiveNotSupported; + } + + if (ytData.isPremiere) { + throw translations[lang].VOTPremiere; + } + if (videoData.duration > 14_400) { + throw translations[lang].VOTVideoIsTooLong; + } + } + return true; + } + + const translateExecutor = async (VIDEO_ID) => { + utils_debug.log("Run videoValidator"); + await videoValidator(); + utils_debug.log("Run translateFunc"); + await translateFunc( + VIDEO_ID, + videoData.detectedLanguage, + videoData.responseLanguage + ); + }; + + // Define a function to handle common events + function handleVideoEvent(event) { + utils_debug.log(`video ${event.type}`); + lipSync(event.type); + } + + // Define a function to stop translation and clean up + function stopTranslation() { + stopTraslate(); + syncVideoVolumeSlider(); + } + + // Define a function to translate a video and handle the callback + function translateFunc(VIDEO_ID, requestLang, responseLang) { + const videoURL = `${siteTranslates[siteHostname]}${VIDEO_ID}`; + translateVideo( + videoURL, + translateFuncParam, + requestLang, + responseLang, + async (success, urlOrError) => { + utils_debug.log("[exec callback] translateVideo"); + if (getVideoId(siteHostname) !== VIDEO_ID) return; + if (!success) { + transformBtn("error", urlOrError); + // if the error line contains information that the translation is being performed, then we wait + if (urlOrError.includes(translations[lang].translationTake)) { + clearTimeout(autoRetry); + autoRetry = setTimeout( + () => translateFunc(VIDEO_ID, requestLang, responseLang), + 60_000 + ); + } + throw urlOrError; + } + + audio.src = urlOrError; + + // cf version only + if ( + false + ) {} + + volumeOnStart = video?.volume; + if (typeof dbDefaultVolume === "number") { + audio.volume = dbDefaultVolume / 100; + } + if ( + typeof dbAutoSetVolumeYandexStyle === "number" && + dbAutoSetVolumeYandexStyle + ) { + video.volume = config/* autoVolume */.IM; + } + + switch (siteHostname) { + case "twitter": + document + .querySelector('div[data-testid="app-bar-back"][role="button"]') + .addEventListener("click", stopTranslation); + break; + case "invidious": + case "piped": + break; + default: + if (siteEvent !== null) { + document.body.addEventListener(siteEvent, stopTranslation); + } + break; + } + + const siteHostnames = [ + "twitch", + "vimeo", + "facebook", + "rutube", + "twitter", + "bilibili.com", + "mail.ru", + ]; + for (let i = 0; i < siteHostnames.length; i++) { + if (siteHostname === siteHostnames[i]) { + const mutationObserver = new MutationObserver( + async (mutations) => { + mutations.forEach(async (mutation) => { + if ( + mutation.type === "attributes" && + mutation.attributeName === "src" && + mutation.target === video && + mutation.target.src !== "" + ) { + stopTranslation(); + firstPlay = true; + } + }); + } + ); + mutationObserver.observe(videoContainer, { + attributes: true, + childList: false, + subtree: true, + attributeOldValue: true, + }); + break; + } + } + + if (video && !video.paused) lipSync("play"); + const videos = document.querySelectorAll("video"); + const events = [ + "playing", + "ratechange", + "play", + "abort", + "waiting", + "pause", + ]; + videos.forEach((v) => + events.forEach((e) => v.addEventListener(e, handleVideoEvent)) + ); + transformBtn("success", translations[lang].disableTranslate); + addVideoSlider(); + addTranslationSlider(); + + const VOTVideoSlider = document.querySelector("#VOTVideoSlider"); + if (VOTVideoSlider) VOTVideoSlider.value = config/* autoVolume */.IM * 100; + + const VOTOriginalVolume = + document.querySelector("#VOTOriginalVolume"); + if (VOTOriginalVolume) { + VOTOriginalVolume.innerText = `${config/* autoVolume */.IM * 100}%`; + } + + const downloadBtn = document.querySelector(".translationDownload"); + downloadBtn.href = urlOrError; + downloadBtn.style.display = "initial"; + } + ); + } + + document.addEventListener("click", (event) => { + const block = document.querySelector(".translationBlock"); + const menuContainer = document.querySelector(".translationMenuContent"); + const isBlock = + block || event.target === block ? block.contains(event.target) : false; + const isContent = + menuContainer || event.target === menuContainer + ? menuContainer.contains(event.target) + : false; + const isVideo = + videoContainer || event.target === videoContainer + ? videoContainer.contains(event.target) + : false; + + utils_debug.log(`[document click] ${isBlock} ${isContent} ${isVideo}`); + if (!(!isBlock && !isContent)) return; + if (!isVideo) logout(0); + + menuContainer.style.display = "none"; + openedMenu = false; + }); + + const addEventListeners = (element, events, handler) => { + events.forEach((event) => element.addEventListener(event, handler)); + }; + + if (siteHostname === "pornhub") { + if (window.location.pathname.includes("view_video.php")) { + const videoElement = document.querySelector( + ".original.mainPlayerDiv > video-element > div" + ); + addEventListeners(videoElement, ["mousemove", "mouseout"], resetTimer); + } else if (window.location.pathname.includes("embed/")) { + const playerElement = document.querySelector("#player"); + addEventListeners(playerElement, ["mousemove", "mouseout"], resetTimer); + } + } else if (siteHostname === "twitter") { + const videoPlayerElement = document.querySelector( + 'div[data-testid="videoPlayer"' + ); + addEventListeners( + videoPlayerElement, + ["mousemove", "mouseout"], + resetTimer + ); + } else { + addEventListeners(videoContainer, ["mousemove", "mouseout"], resetTimer); + } + + document + .querySelector(".translationBlock") + .addEventListener("mousemove", (event) => + changeOpacityOnEvent(event, timer, opacityRatio) + ); + document + .querySelector(".translationMenuContent") + .addEventListener("mousemove", (event) => + changeOpacityOnEvent(event, timer, opacityRatio) + ); + + document.addEventListener("touchstart", (event) => + changeOpacityOnEvent(event, timer, opacityRatio) + ); + document.addEventListener("touchmove", (event) => + changeOpacityOnEvent(event, timer, opacityRatio) + ); + document.addEventListener("touchend", (event) => + changeOpacityOnEvent(event, timer, opacityRatio) + ); + + document + .querySelector(".translationBtn") + .addEventListener("click", async (event) => { + utils_debug.log("[click translationBtn] before all functions & methods"); + event.stopPropagation(); + event.stopImmediatePropagation(); + + // check if the audio source is not empty + if (audio.src) { + utils_debug.log("[click translationBtn] audio.src is not empty"); + stopTraslate(); + return; + } + + try { + utils_debug.log("[click translationBtn] trying execute translation"); + const VIDEO_ID = getVideoId(siteHostname); + + if (!VIDEO_ID) { + throw translations[lang].VOTNoVideoIDFound; + } + + await translateExecutor(VIDEO_ID); + } catch (err) { + transformBtn("error", String(err).substring(4, err.length)); + console.error(err); + } + }); + + video.addEventListener("progress", async (event) => { + event.stopPropagation(); + + if (!(firstPlay && dbAutoTranslate === 1)) { + return; + } + const VIDEO_ID = getVideoId(siteHostname); + + if (!VIDEO_ID) { + throw translations[lang].VOTNoVideoIDFound; + } + + try { + await translateExecutor(VIDEO_ID); + firstPlay = false; + } catch (err) { + transformBtn("error", String(err).substring(4, err.length)); + firstPlay = false; + } + }); + } + + async function initWebsite() { + utils_debug.log("Runned initWebsite function"); + if (config_regexes.youtubeRegex.test(window.location.hostname)) { + if (window.location.pathname.includes("embed")) { + const videoContainer = document.querySelector(".html5-video-container"); + await translateProccessor(videoContainer, "youtube", null); + return; + } + + utils_debug.log("[initWebsite] Found a match with youtube hostname"); + const ytPageEnter = () => { + const videoContainer = document.querySelector( + config_selectors.youtubeSelector + ); + if (videoContainer) { + utils_debug.log("[exec] translateProccessor youtube on page enter"); + translateProccessor(videoContainer, "youtube", "yt-translate-stop"); + } else { + if (!ytplayer || !ytplayer.config) { + utils_debug.log("[exec] ytplayer is null"); + return; + } + ytplayer.config.args.jsapicallback = () => { + utils_debug.log( + "[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)" + ); + translateProccessor(videoContainer, "youtube", "yt-translate-stop"); + }; + } + }; + + document.addEventListener("spfdone", ytPageEnter); + document.addEventListener("yt-navigate-finish", ytPageEnter); + + const ytPageLeave = () => { + document.body.dispatchEvent(new Event("yt-translate-stop")); + }; + + document.addEventListener("spfrequest", ytPageLeave); + document.addEventListener("yt-navigate-start", ytPageLeave); + + if (window.location.hostname.includes("m.youtube.com")) { + let ytmobile = await waitForElm("#player"); + if (ytmobile) { + await sleep(1000); + await translateProccessor(ytmobile, "youtube", "yt-translate-stop"); + + const mutationObserver = new MutationObserver(async (mutations) => { + for (const mutation of mutations) { + if ( + mutation.type === "attributes" && + mutation.attributeName === "src" + ) { + ytmobile = await waitForElm("#player"); + await sleep(1000); + await translateProccessor( + ytmobile, + "youtube", + "yt-translate-stop" + ); + } + } + }); + + mutationObserver.observe(ytmobile, { + attributes: true, + childList: true, + subtree: true, + attributeOldValue: true, + }); + } + const ytPageLeave = () => { + document.body.dispatchEvent(new Event("yt-translate-stop")); + }; + document.addEventListener("spfdone", ytPageLeave); + document.addEventListener("yt-navigate-finish", ytPageLeave); + document.addEventListener("spfrequest", ytPageLeave); + document.addEventListener("yt-navigate-start", ytPageLeave); + } + return; + } + if (window.location.hostname.includes("twitch.tv")) { + utils_debug.log("[initWebsite] Found a match with twitch.tv"); + if ( + window.location.hostname.includes("m.twitch.tv") && + (window.location.pathname.includes("/videos/") || + window.location.pathname.includes("/clip/")) + ) { + utils_debug.log("[initWebsite] Matched Twitch Mobile"); + const el = await waitForElm(config_selectors.twitchMobileSelector); + if (el) { + await sleep(200); + const twitchMobileSelector = document.querySelector( + config_selectors.twitchMobileSelector + ); + await translateProccessor(twitchMobileSelector, "twitch", null); + + const mutationObserver = new MutationObserver(async (mutations) => { + for (const mutation of mutations) { + if ( + mutation.type === "attributes" && + mutation.attributeName === "src" && + mutation.target === twitchMobileSelector?.querySelector("video") + ) { + await sleep(1000); + await translateProccessor(twitchMobileSelector, "twitch", null); + } + } + }); + + mutationObserver.observe(twitchMobileSelector, { + attributes: true, + childList: true, + subtree: true, + attributeOldValue: true, + }); + } + } else if ( + window.location.hostname.includes("player.twitch.tv") || + window.location.hostname.includes("clips.twitch.tv") || + window.location.pathname.includes("/videos/") || + window.location.pathname.includes("/clip/") + ) { + utils_debug.log("[initWebsite] Matched Twitch Desktop"); + const el = await waitForElm(config_selectors.twitchSelector); + if (el) { + await sleep(200); + await translateProccessor(el, "twitch", null); + } + } + utils_debug.log("[initWebsite] Exit function in the twitch section"); + return; + } + if (window.location.hostname.includes("xvideos.com")) { + utils_debug.log("[entered] xvideos"); + await sleep(1000); + await translateProccessor( + document.querySelector(".video-bg-pic"), + "xvideos", + null + ); + return; + } + if (window.location.hostname.includes("pornhub.com")) { + utils_debug.log("[entered] pornhub"); + await sleep(1000); + await translateProccessor( + document.querySelector(".mgp_videoWrapper"), + "pornhub", + null + ); + return; + } + if (sitesInvidious.includes(window.location.hostname)) { + // Need an additional extension to work in chrome-like browsers + utils_debug.log("[entered] invidious"); + await translateProccessor( + document.querySelector("#player"), + "youtube", + null + ); + } else if (sitesPiped.includes(window.location.hostname)) { + // Need an additional extension to work in chrome-like browsers + utils_debug.log("[entered] piped"); + const el = await waitForElm(config_selectors.pipedSelector); + if (el) { + let videoIDNew; + let videoID = getVideoId("youtube"); + await translateProccessor(el, "youtube", "piped"); + setInterval(async () => { + videoIDNew = getVideoId("youtube"); + if (videoID !== videoIDNew) { + if (videoIDNew) { + await translateProccessor( + document.querySelector(config_selectors.pipedSelector), + "youtube", + "piped" + ); + } + videoID = videoIDNew; + } + }, 3000); + } + } else if (/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)) { + utils_debug.log("[entered] vk.com"); + const el = await waitForElm(config_selectors.vkSelector); + if (el) { + await translateProccessor( + document.querySelector(config_selectors.vkSelector), + "vk", + null + ); + let videoIDVKNew; + let videoIDVK = getVideoId("vk"); + setInterval(async () => { + videoIDVKNew = getVideoId("vk"); + if (videoIDVK !== videoIDVKNew) { + if (videoIDVKNew) { + const el = await waitForElm(config_selectors.vkSelector); + if (el) { + await translateProccessor(el, "vk", null); + } + } + videoIDVK = videoIDVKNew; + } + }, 3000); + } + } else if (window.location.hostname.includes("vimeo.com")) { + utils_debug.log("[entered] vimeo.com"); + const el = await waitForElm(config_selectors.vimeoSelector); + if (el) { + await sleep(1000); + await translateProccessor( + document.querySelector(config_selectors.vimeoSelector), + "vimeo", + null + ); + } + } else if (window.location.hostname.includes("9gag.com")) { + await sleep(1000); + await translateProccessor( + document.querySelector(config_selectors.gagSelector), + "9gag", + null + ); + } else if (window.location.hostname.includes("coub.com")) { + await sleep(1000); + await translateProccessor( + document.querySelector(".viewer__player"), + "coub", + null + ); + } else if (window.location.hostname.includes("rutube.ru")) { + const elementSelector = window.location.pathname.includes("/play/embed") + ? "#app > div > div" + : ".video-player > div > div > div:nth-child(2)"; + + const el = await waitForElm(elementSelector); + if (el) { + await translateProccessor(el, "rutube", null); + } + } else if (window.location.hostname.includes("bilibili.com")) { + if (window.location.pathname.includes("/video/")) { + const el = await waitForElm(config_selectors.bilibilicomSelector); + if (el) { + await translateProccessor(el, "bilibili.com", null); + } + } else if ( + window.location.pathname.includes( + "/blackboard/webplayer/embed-old.html" + ) + ) { + const el = await waitForElm("video"); + if (el) { + await translateProccessor(el.parentElement, "bilibili.com", null); + } + } + } else if (window.location.hostname.includes("twitter.com")) { + const el = await waitForElm(config_selectors.twitterSelector); + if (el) { + let videoIDNew; + let videoID = getVideoId("twitter"); + await translateProccessor(el, "twitter", null); + setInterval(async () => { + videoIDNew = getVideoId("twitter"); + if (videoID !== videoIDNew) { + if (videoIDNew) { + await translateProccessor( + document.querySelector(config_selectors.twitterSelector), + "twitter", + null + ); + } + videoID = videoIDNew; + } + }, 3000); + } + } else if (window.location.hostname.includes("my.mail.ru")) { + const el = await waitForElm(config_selectors.mailSelector); + if (el) { + let videoIDNew; + let videoID = getVideoId("mail.ru"); + await translateProccessor(el, "mail.ru", null); + setInterval(async () => { + videoIDNew = getVideoId("mail.ru"); + if (videoID !== videoIDNew) { + if (videoIDNew) { + await translateProccessor( + document.querySelector(config_selectors.mailSelector), + "mail.ru", + null + ); + } + videoID = videoIDNew; + } + }, 3000); + } + } + } + + await initWebsite(); +} + +src_main().catch((e) => { + console.error(e); +}); + +})(); + +/******/ })() +; \ No newline at end of file diff --git a/src/src/config/alternativeUrls.js b/src/src/config/alternativeUrls.js new file mode 100644 index 00000000..fcfb84f0 --- /dev/null +++ b/src/src/config/alternativeUrls.js @@ -0,0 +1,52 @@ +// Sites host Invidious. I tested the performance only on invidious.kevin.rocks, youtu.be and inv.vern.cc +const sitesInvidious = [ + "invidious.snopyta.org", + "yewtu.be", + "invidious.kavin.rocks", + "vid.puffyan.us", + "invidious.namazso.eu", + "inv.riverside.rocks", + "yt.artemislena.eu", + "invidious.flokinet.to", + "invidious.esmailelbob.xyz", + "y.com.sb", + "invidious.nerdvpn.de", + "inv.vern.cc", + "invidious.slipfox.xyz", + "invidio.xamh.de", + "invidious.dhusch.de", +]; + +// Sites host Piped. I tested the performance only on piped.video +const sitesPiped = [ + "piped.video", + "piped.tokhmi.xyz", + "piped.moomoo.me", + "piped.syncpundit.io", + "piped.mha.fi", + "watch.whatever.social", + "piped.garudalinux.org", + "efy.piped.pages.dev", + "watch.leptons.xyz", + "piped.lunar.icu", + "yt.dc09.ru", + "piped.mint.lgbt", + "il.ax", + "piped.privacy.com.de", + "piped.esmailelbob.xyz", + "piped.projectsegfau.lt", + "piped.in.projectsegfau.lt", + "piped.us.projectsegfau.lt", + "piped.privacydev.net", + "piped.palveluntarjoaja.eu", + "piped.smnz.de", + "piped.adminforge.de", + "piped.qdi.fi", + "piped.hostux.net", + "piped.chauvet.pro", + "piped.jotoma.de", + "piped.pfcd.me", + "piped.frontendfriendly.xyz", +]; + +export { sitesInvidious, sitesPiped }; diff --git a/src/src/config/config-cloudflare.js b/src/src/config/config-cloudflare.js new file mode 100644 index 00000000..99c7727f --- /dev/null +++ b/src/src/config/config-cloudflare.js @@ -0,0 +1,5 @@ +// CLOUDFLARE CONFIGURATION +const workerHost = "vot.toil-dump.workers.dev"; +const yandexHmacKey = "gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"; + +export { workerHost, yandexHmacKey }; diff --git a/src/src/config/config.js b/src/src/config/config.js new file mode 100644 index 00000000..beb5726b --- /dev/null +++ b/src/src/config/config.js @@ -0,0 +1,8 @@ +// CONFIGURATION +const workerHost = "api.browser.yandex.ru"; +const yandexHmacKey = "gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"; +const yandexUserAgent = + "Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1"; +const autoVolume = 0.15; // 0.0 - 1.0 (0% - 100%) - default volume of the video with the translation + +export { workerHost, yandexHmacKey, yandexUserAgent, autoVolume }; diff --git a/src/src/config/constants.js b/src/src/config/constants.js new file mode 100644 index 00000000..3cc50e31 --- /dev/null +++ b/src/src/config/constants.js @@ -0,0 +1,400 @@ +const translateFuncParam = 0x40_75_50_00_00_00_00_00; +const availableLangs = { + ru: "Russian", + en: "English", + zh: "Chinese", + fr: "French", + it: "Italian", + es: "Spanish", + de: "German", +}; // available languages for translation +const siteTranslates = { + youtube: "https://youtu.be/", + twitch: "https://twitch.tv/", + vimeo: "https://vimeo.com/", + "9gag": "https://9gag.com/gag/", + vk: "https://vk.com/video?z=", + xvideos: "https://www.xvideos.com/", + pornhub: "https://rt.pornhub.com/view_video.php?viewkey=", + udemy: "https://www.udemy.com", + twitter: "https://twitter.com/i/status/", + facebook: "https://www.facebook.com/", + rutube: "https://rutube.ru/video/", + "bilibili.com": "https://www.bilibili.com/video/", + "mail.ru": "https://my.mail.ru/", + coub: "https://coub.com/view/", +}; +const translations = { + ru: { + recommended: "рекомендуется", + translateVideo: "Перевести видео", + disableTranslate: "Выключить", + translationSettings: "Настройки перевода", + resetSettings: "Сбросить настройки", + videoBeingTranslated: "Видео переводится", + videoLanguage: "Язык видео", + translationLanguage: "Язык перевода", + translationTake: "Перевод займёт", + translationTakeMoreThanHour: "Перевод займёт больше часа", + translationTakeAboutMinute: "Перевод займёт около минуты", + translationTakeFewMinutes: "Перевод займёт несколько минут", + translationTakeApproximatelyMinutes: "Перевод займёт примерно {0} минут", + translationTakeApproximatelyMinute: "Перевод займёт примерно {0} минуты", + unSupportedExtensionError: `Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`, + requestTranslationFailed: "Не удалось запросить перевод видео", + audioNotReceived: "Не получена ссылка на аудио", + grantPermissionToAutoPlay: "Предоставьте разрешение на автовоспроизведение", + neededAdditionalExtension: + "Для поддержки этого сайта необходимо дополнительное расширение", + audioFormatNotSupported: "Формат аудио не поддерживается", + VOTAutoTranslate: "Переводить при открытии", + VOTDontTranslateYourLang: "Не переводить с родного языка", + VOTVolume: "Громкость видео", + VOTVolumeTranslation: "Громкость перевода", + VOTAutoSetVolume: "Уменьшать громкость видео до ", + VOTShowVideoSlider: "Слайдер громкости видео", + VOTSyncVolume: "Связать громкость перевода и видео", + VOTAudioProxy: "Проксировать полученное аудио", + VOTDisableFromYourLang: "VOT: Вы отключили перевод видео на вашем языке", + VOTLiveNotSupported: + "VOT: Не поддерживается перевод трансляций в прямом эфире", + VOTPremiere: "VOT: Дождитесь окончания премьеры перед переводом", + VOTVideoIsTooLong: "VOT: Видео слишком длинное", + VOTNoVideoIDFound: "VOT: Не найдено ID видео", + VOTFailedInitDB: "VOT: Не удалось инициализовать базу данных", + VOTDBNeedUpdate: + "VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу", + VOTDisabledForDBUpdating: `VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`, + VOTFailedWriteToDB: "VOT: Не удалось записать данные в базу данных", + VOTFailedReadFromDB: "VOT: Не удалось получить данные из базы данных", + Russian: "Русский", + English: "Английский", + Chinese: "Китайский", + French: "Французский", + Italian: "Итальянский", + Spanish: "Испанский", + German: "Немецкий", + }, + en: { + recommended: "recommended", + translateVideo: "Translate video", + disableTranslate: "Turn off", + translationSettings: "Translation settings", + resetSettings: "Reset settings", + videoBeingTranslated: "The video is being translated", + videoLanguage: "Video language", + translationLanguage: "Translation language", + translationTake: "The translation will take", + translationTakeMoreThanHour: "The translation will take more than an hour", + translationTakeAboutMinute: "The translation will take about a minute", + translationTakeFewMinutes: "The translation will take a few minutes", + translationTakeApproximatelyMinutes: + "The translation will take approximately {0} minutes", + translationTakeApproximatelyMinute: + "The translation will take approximately {0} minutes", + unSupportedExtensionError: `Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`, + requestTranslationFailed: "Failed to request video translation", + audioNotReceived: "Audio link not received", + grantPermissionToAutoPlay: "Grant permission to autoplay", + neededAdditionalExtension: + "An additional extension is needed to support this site", + audioFormatNotSupported: "The audio format is not supported", + VOTAutoTranslate: "Translate on open", + VOTDontTranslateYourLang: "Do not translate from my language", + VOTVolume: "Video volume", + VOTVolumeTranslation: "Translation Volume", + VOTAutoSetVolume: "Reduce video volume to ", + VOTShowVideoSlider: "Video volume slider", + VOTSyncVolume: "Link translation and video volume", + VOTAudioProxy: "Proxy received audio", + VOTDisableFromYourLang: + "VOT: You have disabled the translation of the video in your language", + VOTLiveNotSupported: "VOT: Translation of live streams is not supported", + VOTPremiere: "VOT: Wait for the premiere to end before translating", + VOTVideoIsTooLong: "VOT: Video is too long", + VOTNoVideoIDFound: "VOT: No video ID found", + VOTFailedInitDB: "VOT: Failed to initialize database", + VOTDBNeedUpdate: + "VOT: The database needs an update, please reload the page", + VOTDisabledForDBUpdating: `VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`, + VOTFailedWriteToDB: "VOT: Data could not be written to the database", + VOTFailedReadFromDB: "VOT: Data could not be retrieved from the database", + Russian: "Russian", + English: "English", + Chinese: "Chinese", + French: "French", + Italian: "Italian", + Spanish: "Spanish", + German: "German", + }, + zh: { + recommended: "推荐使用", + translateVideo: "翻译视频", + disableTranslate: "关掉", + translationSettings: "翻译需要一个多小时", + resetSettings: "重置设置", + videoBeingTranslated: "视频正在翻译中", + videoLanguage: "视频语言", + translationLanguage: "翻译语言", + translationTake: "翻译将采取", + translationTakeMoreThanHour: "翻译将采取一个多小时", + translationTakeAboutMinute: "翻译将采取一分钟", + translationTakeFewMinutes: "翻译将采取几分钟", + translationTakeApproximatelyMinutes: "翻译将采取大约需要{0}分钟", + translationTakeApproximatelyMinute: "翻译将采取大约需要{0}分钟", + unSupportedExtensionError: `错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`, + requestTranslationFailed: "请求视频翻译失败", + audioNotReceived: "未收到音频链接", + grantPermissionToAutoPlay: "授予自动播放权限", + neededAdditionalExtension: "需要一个额外的扩展来支持这个网站", + audioFormatNotSupported: "不支持音频格式", + VOTAutoTranslate: "打开时翻译", + VOTDontTranslateYourLang: "不要从你的语言翻译过来", + VOTVolume: "视频量", + VOTVolumeTranslation: "翻译量", + VOTAutoSetVolume: "将视频音量降低到", + VOTShowVideoSlider: "视频音量滑块", + VOTSyncVolume: "链接翻译和视频音量", + VOTAudioProxy: "代理接收的音频", + VOTDisableFromYourLang: "VOT:你已经禁用了你的语言的视频翻译", + VOTLiveNotSupported: "VOT:不支持直播流的翻译", + VOTPremiere: "VOT:等待首映结束后再翻译", + VOTVideoIsTooLong: "VOT:视频太长", + VOTNoVideoIDFound: "VOT: 没有找到视频ID", + VOTFailedInitDB: "VOT: 初始化数据库失败", + VOTDBNeedUpdate: "VOT: 数据库需要更新,请重新加载页面", + VOTDisabledForDBUpdating: `VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`, + VOTFailedWriteToDB: "VOT: 无法将数据写入数据库", + VOTFailedReadFromDB: "VOT: 无法从数据库中检索数据", + Russian: "俄语", + English: "英语", + Chinese: "中文", + French: "法语", + Italian: "意大利语", + Spanish: "西班牙语", + German: "德语", + }, + de: { + recommended: "es wird empfohlen", + translateVideo: "Video übersetzen", + disableTranslate: "Ausschalten", + translationSettings: "Übersetzungseinstellungen", + resetSettings: "Einstellungen zurücksetzen", + videoBeingTranslated: "Das Video wird übersetzt", + videoLanguage: "Sprache Video", + translationLanguage: "Zielsprache", + translationTake: "Die Übersetzung dauert", + translationTakeMoreThanHour: "Die Übersetzung dauert mehr als eine Stunde", + translationTakeAboutMinute: "Die Übersetzung dauert ungefähr eine Minute", + translationTakeFewMinutes: "Die Übersetzung dauert einige Minuten", + translationTakeApproximatelyMinutes: + "Die Übersetzung dauert ungefähr {0} Minuten", + translationTakeApproximatelyMinute: + "Die Übersetzung dauert ungefähr {0} Minuten", + unSupportedExtensionError: `Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`, + requestTranslationFailed: + "Videoübersetzung konnte nicht angefordert werden", + audioNotReceived: "Audiolink nicht empfangen", + grantPermissionToAutoPlay: + "Erteilen Sie die Berechtigung zur automatischen Wiedergabe", + neededAdditionalExtension: + "Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen", + audioFormatNotSupported: "Das Audioformat wird nicht unterstützt", + VOTAutoTranslate: "Beim Öffnen übersetzen", + VOTDontTranslateYourLang: "Nicht aus Ihrer Sprache übersetzen", + VOTVolume: "Video Lautstärke", + VOTVolumeTranslation: "Übersetzungsvolumen", + VOTAutoSetVolume: "Video-Lautstärke auf reduzieren ", + VOTShowVideoSlider: "Video-Lautstärkeregler", + VOTSyncVolume: "Übersetzungs- und Videolautstärke verknüpfen", + VOTAudioProxy: "Empfangenes Audio proxyen", + VOTDisableFromYourLang: + "VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert", + VOTLiveNotSupported: + "VOT: Übersetzung von Live-Streams wird nicht unterstützt", + VOTPremiere: + "VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen", + VOTVideoIsTooLong: "VOT: Video ist zu lang", + VOTNoVideoIDFound: "VOT: Keine Video-ID gefunden", + VOTFailedInitDB: "VOT: Datenbank konnte nicht initialisiert werden", + VOTDBNeedUpdate: + "VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu", + VOTDisabledForDBUpdating: `VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`, + VOTFailedWriteToDB: + "VOT: Daten konnten nicht in die Datenbank geschrieben werden", + VOTFailedReadFromDB: "VOT: Konnte keine Daten aus der Datenbank abrufen", + Russian: "Russisch", + English: "Englisch", + Chinese: "Chinesisch", + French: "Französisch", + Italian: "Italienisch", + Spanish: "Spanisch", + German: "Deutsch", + }, + es: { + recommended: "es recomendable", + translateVideo: "Traducir video", + disableTranslate: "Apagar", + translationSettings: "Ajustes de traducción", + resetSettings: "Restablecer ajustes", + videoBeingTranslated: "El video está siendo traducido", + videoLanguage: "Idioma del video", + translationLanguage: "Idioma de la traducción", + translationTake: "La traducción tardará", + translationTakeMoreThanHour: "La traducción tardará más de una hora", + translationTakeAboutMinute: + "La traducción tardará aproximadamente un minuto", + translationTakeFewMinutes: "La traducción tardará unos minutos", + translationTakeApproximatelyMinutes: + "La traducción tardará aproximadamente {0} minutos", + translationTakeApproximatelyMinute: + "La traducción tardará aproximadamente {0} minutos", + unSupportedExtensionError: `Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`, + requestTranslationFailed: "Error al solicitar la traducción de vídeo", + audioNotReceived: "Audiolink nicht empfangen", + grantPermissionToAutoPlay: "Conceder permiso de reproducción automática", + neededAdditionalExtension: + "Se necesita una extensión adicional para admitir este sitio", + audioFormatNotSupported: "El formato de audio no es compatible", + VOTAutoTranslate: "Traducir al abrir", + VOTDontTranslateYourLang: "No traduzca de su lengua", + VOTVolume: "Volumen de vídeo", + VOTVolumeTranslation: "Volumen de traducción", + VOTAutoSetVolume: "Reducir el volumen del video al ", + VOTShowVideoSlider: "Deslizador de volumen de video", + VOTSyncVolume: "Vincular el volumen de traducción y video", + VOTAudioProxy: "Proxificar el audio recibido", + VOTDisableFromYourLang: + "VOT: Ha desactivado la traducción del vídeo en su idioma", + VOTLiveNotSupported: + "VOT: No se admite la traducción de transmisiones en vivo", + VOTPremiere: "VOT: Espere a que termine el estreno antes de traducir", + VOTVideoIsTooLong: "VOT: El video es demasiado largo", + VOTNoVideoIDFound: "VOT: No se encontró id de video", + VOTFailedInitDB: "VOT: No se pudo inicializar la base de datos", + VOTDBNeedUpdate: + "VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página", + VOTDisabledForDBUpdating: `VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`, + VOTFailedWriteToDB: "VOT: No se pudo escribir datos en la base de datos", + VOTFailedReadFromDB: "VOT: No se pudo recuperar datos de la base de datos", + Russian: "Ruso", + English: "Inglés", + Chinese: "Chino", + French: "Francés", + Italian: "Italiano", + Spanish: "Español", + German: "Alemán", + }, + fr: { + recommended: "recommande", + translateVideo: "Traduire la vidéo", + disableTranslate: "Désactiver", + translationSettings: "Paramètres de traduction", + resetSettings: "Réinitialiser les paramètres", + videoBeingTranslated: "La vidéo est en cours de traduction", + videoLanguage: "Langue vidéo", + translationLanguage: "Langue cible", + translationTake: "La traduction prendra", + translationTakeMoreThanHour: "La traduction prendra plus d'une heure", + translationTakeAboutMinute: "La traduction prendra environ une minute", + translationTakeFewMinutes: "La traduction prendra quelques minutes", + translationTakeApproximatelyMinutes: + "La traduction prendra environ {0} minutes", + translationTakeApproximatelyMinute: + "La traduction prendra environ {0} minutes", + unSupportedExtensionError: `Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`, + requestTranslationFailed: + "Impossible de demander la traduction de la vidéo", + audioNotReceived: "Lien audio non reçu", + grantPermissionToAutoPlay: "Accorder l'autorisation de lecture automatique", + neededAdditionalExtension: + "Une extension supplémentaire est nécessaire pour prendre en charge ce site", + audioFormatNotSupported: "Format audio non pris en charge", + VOTAutoTranslate: "Traduire à l'ouverture", + VOTDontTranslateYourLang: "Ne pas traduire à partir de votre langue", + VOTVolume: "Volume de la vidéo", + VOTVolumeTranslation: "Volume de traduction", + VOTAutoSetVolume: "Réduire le volume de la vidéo à ", + VOTShowVideoSlider: "Curseur de volume vidéo", + VOTSyncVolume: "Lier le volume de la traduction et de la vidéo", + VOTAudioProxy: "Proxy audio reçu", + VOTDisableFromYourLang: + "VOT: Vous avez désactivé la traduction de la vidéo dans votre langue", + VOTLiveNotSupported: + "VOT: La traduction des flux en direct n'est pas prise en charge", + VOTPremiere: "VOT: Attendez la fin de la première avant de traduire", + VOTVideoIsTooLong: "VOT: La vidéo est trop longue", + VOTNoVideoIDFound: "VOT: ID vidéo introuvable", + VOTFailedInitDB: "VOT: Impossible d'initialiser la base de données", + VOTDBNeedUpdate: + "VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page", + VOTDisabledForDBUpdating: `VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`, + VOTFailedWriteToDB: + "VOT: Impossible d'écrire les données dans la base de données", + VOTFailedReadFromDB: + "VOT: Impossible de récupérer les données de la base de données", + Russian: "Russe", + English: "Anglais", + Chinese: "Chinois", + French: "Français", + Italian: "Italien", + Spanish: "Espagnol", + German: "Allemand", + }, + it: { + recommended: "è consigliabile", + translateVideo: "Traduci il video", + disableTranslate: "Spegnere", + translationSettings: "Impostazioni di traduzione", + resetSettings: "Ripristina impostazioni", + videoBeingTranslated: "Il video è in fase di traduzione", + videoLanguage: "Lingua Video", + translationLanguage: "Lingua di traduzione", + translationTake: "La traduzione richiederà", + translationTakeMoreThanHour: "La traduzione richiederà più di un'ora", + translationTakeAboutMinute: "La traduzione richiederà circa un minuto", + translationTakeFewMinutes: "La traduzione richiederà alcuni minuti", + translationTakeApproximatelyMinutes: + "La traduzione richiederà circa {0} minuti", + translationTakeApproximatelyMinute: + "La traduzione richiederà circa {0} minuti", + unSupportedExtensionError: `Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`, + requestTranslationFailed: "Richiesta di traduzione video non riuscita", + audioNotReceived: "Collegamento audio non ricevuto", + grantPermissionToAutoPlay: + "Concedere l'Autorizzazione per la riproduzione automatica", + neededAdditionalExtension: + "Per supportare questo sito è necessaria un'estensione aggiuntiva", + audioFormatNotSupported: "Il formato audio non è supportato", + VOTAutoTranslate: "Traduci all'apertura", + VOTDontTranslateYourLang: "Non traducete dalla vostra lingua", + VOTVolume: "Volume video", + VOTVolumeTranslation: "Volume di traduzione", + VOTAutoSetVolume: "Riduci il volume del video al ", + VOTShowVideoSlider: "Cursore del volume del video", + VOTSyncVolume: "Collega il volume della traduzione e del video", + VOTAudioProxy: "Proxy audio ricevuto", + VOTDisableFromYourLang: + "VOT: Avete disabilitato la traduzione del video nella vostra lingua", + VOTLiveNotSupported: + "VOT: La traduzione dei flussi dal vivo non è supportata", + VOTPremiere: "VOT: Aspetta che la prima finisca prima di tradurre", + VOTVideoIsTooLong: "VOT: Il video è troppo lungo", + VOTNoVideoIDFound: "VOT: ID video non trovato", + VOTFailedInitDB: "VOT: Impossibile inizializzare il database", + VOTDBNeedUpdate: + "VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina", + VOTDisabledForDBUpdating: `VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`, + VOTFailedWriteToDB: "VOT: Impossibile scrivere dati nel database", + VOTFailedReadFromDB: "VOT: Impossibile recuperare i dati dal database", + Russian: "Russo", + English: "Inglese", + Chinese: "Cinese", + French: "Francese", + Italian: "Italiano", + Spanish: "Spagnolo", + German: "Tedesco", + }, +}; + +export { translateFuncParam, availableLangs, siteTranslates, translations }; diff --git a/src/src/config/regexes.js b/src/src/config/regexes.js new file mode 100644 index 00000000..60a32093 --- /dev/null +++ b/src/src/config/regexes.js @@ -0,0 +1,7 @@ +const regexes = () => { + return { + youtubeRegex: /^(www.|m.)?youtube(-nocookie)?.com$/, + }; +}; + +export default regexes(); diff --git a/src/src/config/selectors.js b/src/src/config/selectors.js new file mode 100644 index 00000000..d7d4b52f --- /dev/null +++ b/src/src/config/selectors.js @@ -0,0 +1,17 @@ +const selectors = () => { + return { + youtubeSelector: ".html5-video-container", + twitchSelector: ".video-ref", + twitchMobileSelector: "main > div > section > div > div > div", + pipedSelector: ".shaka-video-container", + vkSelector: ".videoplayer_media", + twitterSelector: + 'div[data-testid="videoComponent"] > div:nth-child(1) > div', + vimeoSelector: ".player", + gagSelector: ".video-post", + bilibilicomSelector: ".bpx-player-video-wrap", + mailSelector: "#b-video-wrapper", + }; +}; + +export default selectors(); diff --git a/src/src/getUUID.js b/src/src/getUUID.js new file mode 100644 index 00000000..eba3e252 --- /dev/null +++ b/src/src/getUUID.js @@ -0,0 +1,11 @@ +function getUUID(isLower) { + const uuid = ([1e7] + 1e3 + 4e3 + 8e3 + 1e11).replace(/[018]/g, (c) => + ( + c ^ + (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4))) + ).toString(16) + ); + return isLower ? uuid : uuid.toUpperCase(); +} + +export { getUUID }; diff --git a/src/src/headers.json b/src/src/headers.json new file mode 100644 index 00000000..1a7a8cab --- /dev/null +++ b/src/src/headers.json @@ -0,0 +1,75 @@ +{ + "name": "[VOT] - Voice Over Translation", + "description": "A small extension that adds a Yandex Browser video translation to other browsers", + "version": "1.3.4-testing", + "author": "sodapng, mynovelhost, Toil, SashaXser", + "namespace": "vot", + "icon": "https://translate.yandex.ru/icons/favicon.ico", + "updateURL": "https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js", + "downloadURL": "https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js", + "supportURL": "https://github.com/ilyhalight/voice-over-translation/issues", + "homepageURL": "https://github.com/ilyhalight/voice-over-translation/issues", + "match": [ + "*://*.youtube.com/*", + "*://*.youtube-nocookie.com/*", + "*://*.twitch.tv/*", + "*://*.xvideos.com/*", + "*://*.pornhub.com/*", + "*://*.vk.com/*", + "*://*.vk.ru/*", + "*://invidious.snopyta.org/*", + "*://invidious.kavin.rocks/*", + "*://vid.puffyan.us/*", + "*://invidious.namazso.eu/*", + "*://inv.riverside.rocks/*", + "*://yt.artemislena.eu/*", + "*://invidious.flokinet.to/*", + "*://invidious.esmailelbob.xyz/*", + "*://invidious.nerdvpn.de/*", + "*://invidious.slipfox.xyz/*", + "*://invidio.xamh.de/*", + "*://invidious.dhusch.de/*", + "*://*.piped.video/*", + "*://piped.tokhmi.xyz/*", + "*://piped.moomoo.me/*", + "*://piped.syncpundit.io/*", + "*://piped.mha.fi/*", + "*://watch.whatever.social/*", + "*://piped.garudalinux.org/*", + "*://efy.piped.pages.dev/*", + "*://watch.leptons.xyz/*", + "*://piped.lunar.icu/*", + "*://yt.dc09.ru/*", + "*://piped.mint.lgbt/*", + "*://*.il.ax/*", + "*://piped.privacy.com.de/*", + "*://piped.esmailelbob.xyz/*", + "*://piped.projectsegfau.lt/*", + "*://piped.in.projectsegfau.lt/*", + "*://piped.us.projectsegfau.lt/*", + "*://piped.privacydev.net/*", + "*://piped.palveluntarjoaja.eu/*", + "*://piped.smnz.de/*", + "*://piped.adminforge.de/*", + "*://piped.qdi.fi/*", + "*://piped.hostux.net/*", + "*://piped.chauvet.pro/*", + "*://piped.jotoma.de/*", + "*://piped.pfcd.me/*", + "*://piped.frontendfriendly.xyz/*", + "*://*.yewtu.be/*", + "*://inv.vern.cc/*", + "*://*.vimeo.com/*", + "*://*.9gag.com/*", + "*://*.twitter.com/*", + "*://*.facebook.com/*", + "*://*.rutube.ru/*", + "*://*.bilibili.com/*", + "*://my.mail.ru/*" + ], + "require": [ + "https://cdnjs.cloudflare.com/ajax/libs/protobufjs/7.2.3/protobuf.min.js" + ], + "grant": ["GM_xmlhttpRequest", "GM_info"], + "connect": ["api.browser.yandex.ru"] +} diff --git a/src/src/index.js b/src/src/index.js new file mode 100644 index 00000000..05c7ba90 --- /dev/null +++ b/src/src/index.js @@ -0,0 +1,1451 @@ +import "./styles/main.css"; +import { getYTVideoData } from "./utils/getYTVideoData.js"; +import { yandexRequests } from "./yandexRequests.js"; +import { waitForElm, getVideoId, sleep, secsToStrTime } from "./utils/utils.js"; +import { autoVolume } from "./config/config.js"; +import { sitesInvidious, sitesPiped } from "./config/alternativeUrls.js"; +import { + translateFuncParam, + availableLangs, + siteTranslates, + translations, +} from "./config/constants.js"; +import { initDB, readDB, updateDB, deleteDB } from "./indexedDB.js"; +import { + transformBtn, + addTranslationBlock, + createTranslationMenu, + createMenuCheckbox, + createMenuSlider, + createMenuSelect, + lang, +} from "./menu.js"; +import { syncVolume } from "./utils/volume.js"; +import { workerHost } from "./config/config-cloudflare.js"; +import regexes from "./config/regexes.js"; +import selectors from "./config/selectors.js"; +import debug from "./utils/debug.js"; + +const sitesChromiumBlocked = [...sitesInvidious, ...sitesPiped]; + +// translate properties +let translateFromLang = "en"; // default language of video + +let translateToLang = "ru"; // default language of audio response + +let ytData = ""; + +async function main() { + debug.log("Loading extension..."); + debug.log(`Selected menu language: ${lang}`); + // test all translations in console + // debug.translations('ru'); + // debug.translations('en'); + // debug.translations('de'); + // debug.translations('zh'); + // debug.translations('es'); + // debug.translations('fr'); + // debug.translations('it'); + + const rvt = await import( + `./rvt${BUILD_MODE === "cloudflare" ? "-cloudflare" : ""}.js` + ); + + const requestVideoTranslation = rvt.default; + + debug.log("Inited requestVideoTranslation..."); + + if ( + BUILD_MODE !== "cloudflare" && + GM_info?.scriptHandler && + ["Violentmonkey", "FireMonkey", "Greasemonkey", "AdGuard"].includes( + GM_info.scriptHandler + ) + ) { + const errorText = translations[lang].unSupportedExtensionError; + console.error(errorText); + return alert(errorText); + } + + debug.log("Extension compatibility passed..."); + + let timer; + const audio = new Audio(); + let opacityRatio = 0.9; + let openedMenu = false; + + if (BUILD_MODE === "cloudflare") { + var translationPanding = false; + } + + function logout(n) { + if (openedMenu) return; + + document.querySelector(".translationBlock").style.opacity = n; + } + + function resetTimer() { + clearTimeout(timer); + logout(1); + timer = setTimeout(() => { + logout(0); + }, 2000); + } + + function changeOpacityOnEvent(event, timer, opacityRatio) { + clearTimeout(timer); + logout(opacityRatio); + event.stopPropagation(); + } + + const deleteAudioSrc = () => { + audio.src = ""; + audio.removeAttribute("src"); + }; + + // Add menu container + function addTranslationMenu(element) { + if (element.querySelector(".translationMenuContent")) return; + + const container = createTranslationMenu(); + element.appendChild(container); + + // click to translation menu icon + document + .querySelector(".translationMenu") + ?.addEventListener("click", (event) => { + event.stopPropagation(); + const content = document.querySelector(".translationMenuContent"); + content.style.display = openedMenu ? "none" : "block"; + content.style.opacity = opacityRatio; + openedMenu = !openedMenu; + }); + + document + .querySelector(".translationDropDB") + .addEventListener("click", (event) => { + event.stopPropagation(); + deleteDB(); + location.reload(); + }); + + debug.log("VOT: Added translation menu to ", element); + } + + function translateVideo(url, unknown1, requestLang, responseLang, callback) { + debug.log( + `Translate video (url: ${url}, unknown1: ${unknown1}, requestLang: ${requestLang}, responseLang: ${responseLang})` + ); + + if (BUILD_MODE === "cloudflare" && translationPanding) { + debug.log("translationPanding return"); + return; + } + + translationPanding = true; + + requestVideoTranslation( + url, + unknown1, + requestLang, + responseLang, + (success, response) => { + translationPanding = false; + + debug.log("[exec callback] Requesting video translation"); + if (!success) { + callback(false, translations[lang].requestTranslationFailed); + return; + } + + const translateResponse = yandexRequests.decodeResponse(response); + console.log("VOT Response: ", translateResponse); + + switch (translateResponse.status) { + case 0: + callback(false, translateResponse.message); + break; + case 1: + callback( + !!translateResponse.url, + translateResponse.url || translations[lang].audioNotReceived + ); + break; + case 2: + callback( + false, + translateResponse.remainingTime + ? secsToStrTime(translateResponse.remainingTime) + : translations[lang].translationTakeFewMinutes + ); + break; + case 3: + /* + Иногда, в ответе приходит статус код 3, но видео всё, так же, ожидает перевода. В конечном итоге, это занимает слишком много времени, + как-будто сервер не понимает, что данное видео уже недавно было переведено и заместо возвращения готовой ссылки на перевод начинает переводить видео заново при чём у него это получается за очень длительное время + */ + callback(false, translations[lang].videoBeingTranslated); + break; + } + } + ); + } + + async function translateProccessor(videoContainer, siteHostname, siteEvent) { + debug.log("[translateProccessor] execute on element: ", videoContainer); + + let video; + let autoRetry; + let volumeOnStart; + let tempOriginalVolume; + let tempVolume; + let dbAutoTranslate; + let dbDefaultVolume; + let dbShowVideoSlider; + let dbAutoSetVolumeYandexStyle; + let dontTranslateYourLang; + let dbSyncVolume; + let dbAudioProxy; // cf version only + let firstPlay = true; + let isDBInited; + + debug.log("videoContainer", videoContainer); + + video = + siteHostname === "vimeo" + ? videoContainer.querySelector( + ".vp-video-wrapper > .vp-video > .vp-telecine > video" + ) + : videoContainer.querySelector("video"); + + debug.log("video", video); + + let videoData = await getVideoData(); + console.log("VOT Video Data: ", videoData); + + const container = + siteHostname === "pornhub" && + window.location.pathname.includes("view_video.php") + ? document.querySelector(".original.mainPlayerDiv") + : siteHostname === "pornhub" && + window.location.pathname.includes("embed/") + ? document.querySelector("body") + : window.location.hostname.includes("m.youtube.com") + ? document.querySelector("#player-control-container") + : videoContainer; + + addTranslationBlock(container); + addTranslationMenu(container); + + try { + isDBInited = await initDB(); + } catch (err) { + console.error( + "[VOT] Failed to initialize database settings. All changes made will not be saved", + err + ); + } + + const menuOptions = document.querySelector(".translationMenuOptions"); + if (menuOptions && !menuOptions.querySelector("#VOTTranslateFromLang")) { + const selectFromLangOptions = [ + { + label: translations[lang].videoLanguage, + value: "default", + disabled: true, + }, + ...Object.entries(availableLangs).map(([key, value]) => ({ + label: translations[lang][value], + value: key, + selected: videoData.detectedLanguage === key, + })), + ]; + + const selectToLangOptions = [ + { + label: translations[lang].translationLanguage, + value: "default", + disabled: true, + }, + ...Object.entries(availableLangs).map(([key, value]) => ({ + label: translations[lang][value], + value: key, + selected: videoData.responseLanguage === key, + })), + ]; + + const selectFromLang = createMenuSelect( + "VOTTranslateFromLang", + selectFromLangOptions + ); + + const selectToLang = createMenuSelect( + "VOTTranslateToLang", + selectToLangOptions + ).firstElementChild; + + selectFromLang.id = "VOTSelectLanguages"; + selectFromLang.innerHTML += ` + + + + `; + + selectFromLang.appendChild(selectToLang); + menuOptions.appendChild(selectFromLang); + + menuOptions + .querySelector("#VOTTranslateFromLang") + .addEventListener("change", async (event) => { + debug.log("[onchange] select from language", event.target.value); + videoData = await setDetectedLangauge(videoData, event.target.value); + }); + + menuOptions + .querySelector("#VOTTranslateToLang") + .addEventListener("change", async (event) => { + debug.log("[onchange] select to language", event.target.value); + videoData = await setResponseLangauge(videoData, event.target.value); + }); + } + + if (isDBInited) { + const dbData = await readDB(); + if (dbData) { + dbAutoTranslate = dbData.autoTranslate; + dbDefaultVolume = dbData.defaultVolume; + dbShowVideoSlider = dbData.showVideoSlider; + dbAutoSetVolumeYandexStyle = dbData.autoSetVolumeYandexStyle; + dontTranslateYourLang = dbData.dontTranslateYourLang; + dbAudioProxy = dbData.audioProxy; // cf version only + dbSyncVolume = dbData.syncVolume; // youtube only + + debug.log("[db] data from db: ", dbData); + + if ( + dbAutoTranslate !== undefined && + menuOptions && + !menuOptions.querySelector("#VOTAutoTranslate") + ) { + const checkbox = createMenuCheckbox( + "VOTAutoTranslate", + dbAutoTranslate, + translations[lang].VOTAutoTranslate + + (siteHostname === "vk" || + window.location.hostname.includes("m.twitch.tv") + ? ` (${translations[lang].recommended})` + : "") + ); + + checkbox.querySelector("#VOTAutoTranslate").onclick = async ( + event + ) => { + event.stopPropagation(); + const value = Number(event.target.checked); + await updateDB({ autoTranslate: value }); + dbAutoTranslate = value; + debug.log( + "autoTranslate value changed. New value: ", + dbAutoTranslate + ); + }; + + menuOptions.appendChild(checkbox); + } + + if ( + window.location.hostname.includes("youtube.com") && + dontTranslateYourLang !== undefined && + menuOptions && + !menuOptions.querySelector("#VOTDontTranslateYourLang") + ) { + const checkbox = createMenuCheckbox( + "VOTDontTranslateYourLang", + dontTranslateYourLang, + translations[lang].VOTDontTranslateYourLang + ); + + checkbox.querySelector("#VOTDontTranslateYourLang").onclick = async ( + event + ) => { + event.stopPropagation(); + const value = Number(event.target.checked); + await updateDB({ dontTranslateYourLang: value }); + dontTranslateYourLang = value; + debug.log( + "dontTranslateYourLang value changed. New value: ", + dontTranslateYourLang + ); + }; + + menuOptions.appendChild(checkbox); + } + + if ( + dbAutoSetVolumeYandexStyle !== undefined && + menuOptions && + !menuOptions.querySelector("#VOTAutoSetVolume") + ) { + const checkbox = createMenuCheckbox( + "VOTAutoSetVolume", + dbAutoSetVolumeYandexStyle, + translations[lang].VOTAutoSetVolume + `${autoVolume * 100}%` + ); + + checkbox.querySelector("#VOTAutoSetVolume").onclick = async ( + event + ) => { + event.stopPropagation(); + const value = Number(event.target.checked); + await updateDB({ autoSetVolumeYandexStyle: value }); + dbAutoSetVolumeYandexStyle = value; + debug.log( + "autoSetVolumeYandexStyle value changed. New value: ", + dbAutoSetVolumeYandexStyle + ); + }; + + menuOptions.appendChild(checkbox); + } + + if ( + dbShowVideoSlider !== undefined && + menuOptions && + !menuOptions.querySelector("#VOTShowVideoSlider") + ) { + const checkbox = createMenuCheckbox( + "VOTShowVideoSlider", + dbShowVideoSlider, + translations[lang].VOTShowVideoSlider + ); + + checkbox.querySelector("#VOTShowVideoSlider").onclick = async ( + event + ) => { + event.stopPropagation(); + const value = Number(event.target.checked); + await updateDB({ showVideoSlider: value }); + dbShowVideoSlider = value; + debug.log( + "showVideoSlider value changed. New value: ", + dbShowVideoSlider + ); + if ( + dbShowVideoSlider === 1 && + document.querySelector(".translationBtn").dataset.state === + "success" + ) { + addVideoSlider(); + } else { + document.querySelector("#VOTVideoSlider")?.parentElement.remove(); + } + }; + + menuOptions.appendChild(checkbox); + } + + if ( + window.location.hostname.includes("youtube.com") && + !window.location.hostname.includes("m.youtube.com") && + dbSyncVolume !== undefined && + menuOptions && + !menuOptions.querySelector("#VOTSyncVolume") + ) { + const checkbox = createMenuCheckbox( + "VOTSyncVolume", + dbSyncVolume, + translations[lang].VOTSyncVolume + ); + + checkbox.querySelector("#VOTSyncVolume").onclick = async (event) => { + event.stopPropagation(); + const value = Number(event.target.checked); + await updateDB({ syncVolume: value }); + dbSyncVolume = value; + debug.log("syncVolume value changed. New value: ", dbSyncVolume); + }; + + menuOptions.appendChild(checkbox); + } + + // cf version only + if ( + BUILD_MODE === "cloudflare" && + dbAudioProxy !== undefined && + menuOptions && + !menuOptions.querySelector("#VOTAudioProxy") + ) { + const checkbox = createMenuCheckbox( + "VOTAudioProxy", + dbAudioProxy, + translations[lang].VOTAudioProxy + ); + + checkbox.querySelector("#VOTAudioProxy").onclick = async (event) => { + event.stopPropagation(); + const value = Number(event.target.checked); + await updateDB({ audioProxy: value }); + dbAudioProxy = value; + debug.log("audioProxy value changed. New value: ", dbAudioProxy); + }; + + menuOptions.appendChild(checkbox); + } + } + } + + transformBtn("none", translations[lang].translateVideo); + + if ( + window.location.hostname.includes("youtube.com") && + !window.location.hostname.includes("m.youtube.com") + ) { + const syncVolumeObserver = new MutationObserver(async function ( + mutations + ) { + mutations.forEach(async function (mutation) { + if ( + mutation.type === "attributes" && + mutation.attributeName === "aria-valuenow" && + document.querySelector("#VOTVideoSlider") + ) { + syncVideoVolumeSlider(); + } + }); + }); + + syncVolumeObserver.observe(document.querySelector(".ytp-volume-panel"), { + attributes: true, + childList: false, + subtree: true, + attributeOldValue: true, + }); + } + + function setSelectMenuValues(from, to = lang) { + if (!document.querySelector("#VOTSelectLanguages")) { + return; + } + console.log(`Set translation from ${from} to ${to}`); + document.querySelector("#VOTTranslateFromLang").value = from; + document.querySelector("#VOTTranslateToLang").value = to; + } + + // data - ytData or VideoData + async function setDetectedLangauge(data, videolang) { + switch (videolang) { + case "en": + data.detectedLanguage = videolang; + data.responseLanguage = lang; + break; + case "ru": + data.detectedLanguage = videolang; + data.responseLanguage = lang; + if (lang == "ru") data.responseLanguage = "en"; + break; + default: + if (!Object.keys(availableLangs).includes(videolang)) { + return setDetectedLangauge(data, "en"); + } + + data.detectedLanguage = videolang; + } + + setSelectMenuValues(data.detectedLanguage, data.responseLanguage); + + return data; + } + + // data - ytData or VideoData + async function setResponseLangauge(data, videolang) { + switch (videolang) { + case "en": + data.responseLanguage = videolang; + data.detectedLanguage = "ru"; + break; + default: + if (!Object.keys(availableLangs).includes(videolang)) { + return setResponseLangauge(data, "ru"); + } + + if (data.detectedLanguage && data.responseLanguage === lang) { + data.detectedLanguage = "en"; + } + + data.responseLanguage = videolang; + } + + setSelectMenuValues(data.detectedLanguage, data.responseLanguage); + + return data; + } + + function stopTraslate() { + // Default actions on stop translate + audio.pause(); + video.removeEventListener(".translate", stopTraslate, false); + deleteAudioSrc(); + document.querySelector("#VOTVideoSlider")?.parentElement.remove(); + document.querySelector("#VOTTranslationSlider")?.parentElement.remove(); + const downloadBtn = document.querySelector(".translationDownload"); + downloadBtn.href = ""; + downloadBtn.style.display = "none"; + transformBtn("none", translations[lang].translateVideo); + if (volumeOnStart) { + video.volume = volumeOnStart; + } + } + + function syncVideoVolumeSlider() { + // Sync volume slider with original video (youtube only) + const newSlidersVolume = document + .querySelector(".ytp-volume-panel") + .getAttribute("aria-valuenow"); + + const videoSlider = document.querySelector("#VOTVideoSlider"); + + if (!videoSlider) { + return; + } + videoSlider.value = newSlidersVolume; + + const videoVolumeLabel = document.querySelector("#VOTVideoVolume"); + + if (videoVolumeLabel) { + videoVolumeLabel.innerText = `${newSlidersVolume}%`; + } + + if (dbSyncVolume === 1) { + tempOriginalVolume = Number(newSlidersVolume); + } + } + + async function getVideoData() { + const videoData = {}; + + videoData.duration = video?.duration || 0; + + videoData.videoId = getVideoId(siteHostname); + + videoData.detectedLanguage = translateFromLang; + + videoData.responseLanguage = translateToLang; + + if (window.location.hostname.includes("youtube.com")) { + ytData = await getYTVideoData(); + ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); + videoData.detectedLanguage = ytData.detectedLanguage; + videoData.responseLanguage = ytData.responseLanguage; + } else if ( + window.location.hostname.includes("rutube") || + window.location.hostname.includes("my.mail.ru") + ) { + videoData.detectedLanguage = "ru"; + videoData.responseLanguage = "en"; + } else if (window.location.hostname.includes("bilibili.com")) { + videoData.detectedLanguage = "zh"; + } + + return videoData; + } + + const lipSync = (mode = false) => { + debug.log("lipsync video", video); + if (!video) { + return; + } + audio.currentTime = video.currentTime; + audio.playbackRate = video.playbackRate; + + if (!mode) { + debug.log("lipsync mode is not set"); + return; + } + + if (mode === "play") { + debug.log("lipsync mode is play"); + const audioPromise = audio.play(); + if (audioPromise !== undefined) { + audioPromise.catch((e) => { + console.error(e); + if (e.name === "NotAllowedError") { + const errorMessage = translations[lang].grantPermissionToAutoPlay; + transformBtn("error", errorMessage); + throw `VOT: ${errorMessage}`; + } else if (e.name === "NotSupportedError") { + const errorMessage = sitesChromiumBlocked.includes( + window.location.hostname + ) + ? translations[lang].neededAdditionalExtension + : translations[lang].audioFormatNotSupported; + transformBtn("error", errorMessage); + throw `VOT: ${errorMessage}`; + } + }); + } + return; + } + if (mode === "pause" || "stop" || "waiting" || "abort") { + debug.log(`lipsync mode is ${mode}`); + audio.pause(); + } + if (mode === "playing") { + debug.log("lipsync mode is playing"); + audio.play(); + } + }; + + function addVideoSlider() { + if ( + dbShowVideoSlider !== 1 || + document.querySelector("#VOTVideoSlider") || + document.querySelector(".translationBtn").dataset.state !== "success" + ) { + return; + } + + const newVolume = + window.location.hostname.includes("youtube.com") && + !dbAutoSetVolumeYandexStyle + ? document + .querySelector(".ytp-volume-panel") + ?.getAttribute("aria-valuenow") + : Math.round(video.volume * 100); + tempOriginalVolume = newVolume; + + const slider = createMenuSlider( + "VOTVideoSlider", + newVolume, + `${translations[lang].VOTVolume}: ${newVolume}%` + ); + + slider.querySelector("#VOTVideoSlider").oninput = (event) => { + const { value } = event.target; + video.volume = value / 100; + slider.querySelector("#VOTOriginalVolume").innerText = `${value}%`; + + if (dbSyncVolume !== 1) { + return; + } + + // Sync translation volume slider with video volume slider + const translateVolumeSlider = document.querySelector( + "#VOTTranslationSlider" + ); + + if (!translateVolumeSlider) { + return; + } + const translateVolume = Number(translateVolumeSlider.value); + const finalValue = syncVolume( + audio, + value, + translateVolume, + tempOriginalVolume + ); + + translateVolumeSlider.value = finalValue; + + const translateVolumeLabel = document.querySelector( + "#VOTTranslationVolume" + ); + + if (translateVolumeLabel) { + translateVolumeLabel.innerText = `${finalValue}%`; + } + + tempVolume = finalValue; + tempOriginalVolume = value; + }; + + const menuOptions = document.querySelector(".translationMenuOptions"); + menuOptions.appendChild(slider); + } + + function addTranslationSlider() { + // Return early if slider already exists or translation is not successful + if ( + document.querySelector("#VOTTranslationSlider") || + document.querySelector(".translationBtn").dataset.state !== "success" + ) { + return; + } + + // Use dbDefaultVolume or 100 as the default translation volume + const defaultTranslateVolume = + typeof dbDefaultVolume === "number" ? dbDefaultVolume : 100; + tempOriginalVolume = defaultTranslateVolume; + + // Create a slider element with the default volume and label + const slider = createMenuSlider( + "VOTTranslationSlider", + defaultTranslateVolume, + `${translations[lang].VOTVolumeTranslation}: ${defaultTranslateVolume}%` + ); + + // Add an input event listener to the slider + slider.querySelector("#VOTTranslationSlider").oninput = async ({ + target: { value }, + }) => { + // Set the audio volume to the slider value + audio.volume = value / 100; + + // Update the volume label + document.querySelector("#VOTTranslationVolume").innerText = `${value}%`; + + // Update the database with the new volume value + await updateDB({ defaultVolume: Number(value) }); + dbDefaultVolume = Number(value); + + // Sync translation volume with video volume if dbSyncVolume is 1 + if (dbSyncVolume === 1) { + syncTranslationWithVideo(value); + } + }; + + // Append the slider to the menu options + const menuOptions = document.querySelector(".translationMenuOptions"); + menuOptions.appendChild(slider); + } + + // A helper function to sync translation volume with video volume + function syncTranslationWithVideo(translationValue) { + // Get the video volume slider element + const videoVolumeSlider = document.querySelector("#VOTVideoSlider"); + + if (!videoVolumeSlider) { + return; + } + // Get the video volume value + const videoVolume = Number(videoVolumeSlider.value); + + // Calculate the synced video volume based on the translation volume + const finalValue = syncVolume( + video, + translationValue, + videoVolume, + tempVolume + ); + + // Set the video volume slider value to the synced value + videoVolumeSlider.value = finalValue; + + // Update the video volume label + const videoVolumeLabel = document.querySelector("#VOTOriginalVolume"); + if (videoVolumeLabel) videoVolumeLabel.innerText = `${finalValue}%`; + + // Update the temp variables for future syncing + tempOriginalVolume = finalValue; + tempVolume = translationValue; + } + + async function videoValidator() { + if (window.location.hostname.includes("youtube.com")) { + ytData = setDetectedLangauge(ytData, ytData.detectedLanguage); + debug.log("VideoValidator videoData: ", videoData); + if (dontTranslateYourLang === 1 && ytData.detectedLanguage === lang) { + firstPlay = false; + throw translations[lang].VOTDisableFromYourLang; + } + + if (ytData.isLive) { + throw translations[lang].VOTLiveNotSupported; + } + + if (ytData.isPremiere) { + throw translations[lang].VOTPremiere; + } + if (videoData.duration > 14_400) { + throw translations[lang].VOTVideoIsTooLong; + } + } + return true; + } + + const translateExecutor = async (VIDEO_ID) => { + debug.log("Run videoValidator"); + await videoValidator(); + debug.log("Run translateFunc"); + await translateFunc( + VIDEO_ID, + videoData.detectedLanguage, + videoData.responseLanguage + ); + }; + + // Define a function to handle common events + function handleVideoEvent(event) { + debug.log(`video ${event.type}`); + lipSync(event.type); + } + + // Define a function to stop translation and clean up + function stopTranslation() { + stopTraslate(); + syncVideoVolumeSlider(); + } + + // Define a function to translate a video and handle the callback + function translateFunc(VIDEO_ID, requestLang, responseLang) { + const videoURL = `${siteTranslates[siteHostname]}${VIDEO_ID}`; + translateVideo( + videoURL, + translateFuncParam, + requestLang, + responseLang, + async (success, urlOrError) => { + debug.log("[exec callback] translateVideo"); + if (getVideoId(siteHostname) !== VIDEO_ID) return; + if (!success) { + transformBtn("error", urlOrError); + // if the error line contains information that the translation is being performed, then we wait + if (urlOrError.includes(translations[lang].translationTake)) { + clearTimeout(autoRetry); + autoRetry = setTimeout( + () => translateFunc(VIDEO_ID, requestLang, responseLang), + 60_000 + ); + } + throw urlOrError; + } + + audio.src = urlOrError; + + // cf version only + if ( + BUILD_MODE === "cloudflare" && + dbAudioProxy === 1 && + urlOrError.startsWith("https://") + ) { + const audioPath = urlOrError.replace( + "https://vtrans.s3-private.mds.yandex.net/tts/prod/", + "" + ); + const proxiedAudioUrl = `https://${workerHost}/video-translation/audio-proxy/${audioPath}`; + console.log(`VOT Audio proxied via ${proxiedAudioUrl}`); + audio.src = proxiedAudioUrl; + } + + volumeOnStart = video?.volume; + if (typeof dbDefaultVolume === "number") { + audio.volume = dbDefaultVolume / 100; + } + if ( + typeof dbAutoSetVolumeYandexStyle === "number" && + dbAutoSetVolumeYandexStyle + ) { + video.volume = autoVolume; + } + + switch (siteHostname) { + case "twitter": + document + .querySelector('div[data-testid="app-bar-back"][role="button"]') + .addEventListener("click", stopTranslation); + break; + case "invidious": + case "piped": + break; + default: + if (siteEvent !== null) { + document.body.addEventListener(siteEvent, stopTranslation); + } + break; + } + + const siteHostnames = [ + "twitch", + "vimeo", + "facebook", + "rutube", + "twitter", + "bilibili.com", + "mail.ru", + ]; + for (let i = 0; i < siteHostnames.length; i++) { + if (siteHostname === siteHostnames[i]) { + const mutationObserver = new MutationObserver( + async (mutations) => { + mutations.forEach(async (mutation) => { + if ( + mutation.type === "attributes" && + mutation.attributeName === "src" && + mutation.target === video && + mutation.target.src !== "" + ) { + stopTranslation(); + firstPlay = true; + } + }); + } + ); + mutationObserver.observe(videoContainer, { + attributes: true, + childList: false, + subtree: true, + attributeOldValue: true, + }); + break; + } + } + + if (video && !video.paused) lipSync("play"); + const videos = document.querySelectorAll("video"); + const events = [ + "playing", + "ratechange", + "play", + "abort", + "waiting", + "pause", + ]; + videos.forEach((v) => + events.forEach((e) => v.addEventListener(e, handleVideoEvent)) + ); + transformBtn("success", translations[lang].disableTranslate); + addVideoSlider(); + addTranslationSlider(); + + const VOTVideoSlider = document.querySelector("#VOTVideoSlider"); + if (VOTVideoSlider) VOTVideoSlider.value = autoVolume * 100; + + const VOTOriginalVolume = + document.querySelector("#VOTOriginalVolume"); + if (VOTOriginalVolume) { + VOTOriginalVolume.innerText = `${autoVolume * 100}%`; + } + + const downloadBtn = document.querySelector(".translationDownload"); + downloadBtn.href = urlOrError; + downloadBtn.style.display = "initial"; + } + ); + } + + document.addEventListener("click", (event) => { + const block = document.querySelector(".translationBlock"); + const menuContainer = document.querySelector(".translationMenuContent"); + const isBlock = + block || event.target === block ? block.contains(event.target) : false; + const isContent = + menuContainer || event.target === menuContainer + ? menuContainer.contains(event.target) + : false; + const isVideo = + videoContainer || event.target === videoContainer + ? videoContainer.contains(event.target) + : false; + + debug.log(`[document click] ${isBlock} ${isContent} ${isVideo}`); + if (!(!isBlock && !isContent)) return; + if (!isVideo) logout(0); + + menuContainer.style.display = "none"; + openedMenu = false; + }); + + const addEventListeners = (element, events, handler) => { + events.forEach((event) => element.addEventListener(event, handler)); + }; + + if (siteHostname === "pornhub") { + if (window.location.pathname.includes("view_video.php")) { + const videoElement = document.querySelector( + ".original.mainPlayerDiv > video-element > div" + ); + addEventListeners(videoElement, ["mousemove", "mouseout"], resetTimer); + } else if (window.location.pathname.includes("embed/")) { + const playerElement = document.querySelector("#player"); + addEventListeners(playerElement, ["mousemove", "mouseout"], resetTimer); + } + } else if (siteHostname === "twitter") { + const videoPlayerElement = document.querySelector( + 'div[data-testid="videoPlayer"' + ); + addEventListeners( + videoPlayerElement, + ["mousemove", "mouseout"], + resetTimer + ); + } else { + addEventListeners(videoContainer, ["mousemove", "mouseout"], resetTimer); + } + + document + .querySelector(".translationBlock") + .addEventListener("mousemove", (event) => + changeOpacityOnEvent(event, timer, opacityRatio) + ); + document + .querySelector(".translationMenuContent") + .addEventListener("mousemove", (event) => + changeOpacityOnEvent(event, timer, opacityRatio) + ); + + document.addEventListener("touchstart", (event) => + changeOpacityOnEvent(event, timer, opacityRatio) + ); + document.addEventListener("touchmove", (event) => + changeOpacityOnEvent(event, timer, opacityRatio) + ); + document.addEventListener("touchend", (event) => + changeOpacityOnEvent(event, timer, opacityRatio) + ); + + document + .querySelector(".translationBtn") + .addEventListener("click", async (event) => { + debug.log("[click translationBtn] before all functions & methods"); + event.stopPropagation(); + event.stopImmediatePropagation(); + + // check if the audio source is not empty + if (audio.src) { + debug.log("[click translationBtn] audio.src is not empty"); + stopTraslate(); + return; + } + + try { + debug.log("[click translationBtn] trying execute translation"); + const VIDEO_ID = getVideoId(siteHostname); + + if (!VIDEO_ID) { + throw translations[lang].VOTNoVideoIDFound; + } + + await translateExecutor(VIDEO_ID); + } catch (err) { + transformBtn("error", String(err).substring(4, err.length)); + console.error(err); + } + }); + + video.addEventListener("progress", async (event) => { + event.stopPropagation(); + + if (!(firstPlay && dbAutoTranslate === 1)) { + return; + } + const VIDEO_ID = getVideoId(siteHostname); + + if (!VIDEO_ID) { + throw translations[lang].VOTNoVideoIDFound; + } + + try { + await translateExecutor(VIDEO_ID); + firstPlay = false; + } catch (err) { + transformBtn("error", String(err).substring(4, err.length)); + firstPlay = false; + } + }); + } + + async function initWebsite() { + debug.log("Runned initWebsite function"); + if (regexes.youtubeRegex.test(window.location.hostname)) { + if (window.location.pathname.includes("embed")) { + const videoContainer = document.querySelector(".html5-video-container"); + await translateProccessor(videoContainer, "youtube", null); + return; + } + + debug.log("[initWebsite] Found a match with youtube hostname"); + const ytPageEnter = () => { + const videoContainer = document.querySelector( + selectors.youtubeSelector + ); + if (videoContainer) { + debug.log("[exec] translateProccessor youtube on page enter"); + translateProccessor(videoContainer, "youtube", "yt-translate-stop"); + } else { + if (!ytplayer || !ytplayer.config) { + debug.log("[exec] ytplayer is null"); + return; + } + ytplayer.config.args.jsapicallback = () => { + debug.log( + "[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)" + ); + translateProccessor(videoContainer, "youtube", "yt-translate-stop"); + }; + } + }; + + document.addEventListener("spfdone", ytPageEnter); + document.addEventListener("yt-navigate-finish", ytPageEnter); + + const ytPageLeave = () => { + document.body.dispatchEvent(new Event("yt-translate-stop")); + }; + + document.addEventListener("spfrequest", ytPageLeave); + document.addEventListener("yt-navigate-start", ytPageLeave); + + if (window.location.hostname.includes("m.youtube.com")) { + let ytmobile = await waitForElm("#player"); + if (ytmobile) { + await sleep(1000); + await translateProccessor(ytmobile, "youtube", "yt-translate-stop"); + + const mutationObserver = new MutationObserver(async (mutations) => { + for (const mutation of mutations) { + if ( + mutation.type === "attributes" && + mutation.attributeName === "src" + ) { + ytmobile = await waitForElm("#player"); + await sleep(1000); + await translateProccessor( + ytmobile, + "youtube", + "yt-translate-stop" + ); + } + } + }); + + mutationObserver.observe(ytmobile, { + attributes: true, + childList: true, + subtree: true, + attributeOldValue: true, + }); + } + const ytPageLeave = () => { + document.body.dispatchEvent(new Event("yt-translate-stop")); + }; + document.addEventListener("spfdone", ytPageLeave); + document.addEventListener("yt-navigate-finish", ytPageLeave); + document.addEventListener("spfrequest", ytPageLeave); + document.addEventListener("yt-navigate-start", ytPageLeave); + } + return; + } + if (window.location.hostname.includes("twitch.tv")) { + debug.log("[initWebsite] Found a match with twitch.tv"); + if ( + window.location.hostname.includes("m.twitch.tv") && + (window.location.pathname.includes("/videos/") || + window.location.pathname.includes("/clip/")) + ) { + debug.log("[initWebsite] Matched Twitch Mobile"); + const el = await waitForElm(selectors.twitchMobileSelector); + if (el) { + await sleep(200); + const twitchMobileSelector = document.querySelector( + selectors.twitchMobileSelector + ); + await translateProccessor(twitchMobileSelector, "twitch", null); + + const mutationObserver = new MutationObserver(async (mutations) => { + for (const mutation of mutations) { + if ( + mutation.type === "attributes" && + mutation.attributeName === "src" && + mutation.target === twitchMobileSelector?.querySelector("video") + ) { + await sleep(1000); + await translateProccessor(twitchMobileSelector, "twitch", null); + } + } + }); + + mutationObserver.observe(twitchMobileSelector, { + attributes: true, + childList: true, + subtree: true, + attributeOldValue: true, + }); + } + } else if ( + window.location.hostname.includes("player.twitch.tv") || + window.location.hostname.includes("clips.twitch.tv") || + window.location.pathname.includes("/videos/") || + window.location.pathname.includes("/clip/") + ) { + debug.log("[initWebsite] Matched Twitch Desktop"); + const el = await waitForElm(selectors.twitchSelector); + if (el) { + await sleep(200); + await translateProccessor(el, "twitch", null); + } + } + debug.log("[initWebsite] Exit function in the twitch section"); + return; + } + if (window.location.hostname.includes("xvideos.com")) { + debug.log("[entered] xvideos"); + await sleep(1000); + await translateProccessor( + document.querySelector(".video-bg-pic"), + "xvideos", + null + ); + return; + } + if (window.location.hostname.includes("pornhub.com")) { + debug.log("[entered] pornhub"); + await sleep(1000); + await translateProccessor( + document.querySelector(".mgp_videoWrapper"), + "pornhub", + null + ); + return; + } + if (sitesInvidious.includes(window.location.hostname)) { + // Need an additional extension to work in chrome-like browsers + debug.log("[entered] invidious"); + await translateProccessor( + document.querySelector("#player"), + "youtube", + null + ); + } else if (sitesPiped.includes(window.location.hostname)) { + // Need an additional extension to work in chrome-like browsers + debug.log("[entered] piped"); + const el = await waitForElm(selectors.pipedSelector); + if (el) { + let videoIDNew; + let videoID = getVideoId("youtube"); + await translateProccessor(el, "youtube", "piped"); + setInterval(async () => { + videoIDNew = getVideoId("youtube"); + if (videoID !== videoIDNew) { + if (videoIDNew) { + await translateProccessor( + document.querySelector(selectors.pipedSelector), + "youtube", + "piped" + ); + } + videoID = videoIDNew; + } + }, 3000); + } + } else if (/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)) { + debug.log("[entered] vk.com"); + const el = await waitForElm(selectors.vkSelector); + if (el) { + await translateProccessor( + document.querySelector(selectors.vkSelector), + "vk", + null + ); + let videoIDVKNew; + let videoIDVK = getVideoId("vk"); + setInterval(async () => { + videoIDVKNew = getVideoId("vk"); + if (videoIDVK !== videoIDVKNew) { + if (videoIDVKNew) { + const el = await waitForElm(selectors.vkSelector); + if (el) { + await translateProccessor(el, "vk", null); + } + } + videoIDVK = videoIDVKNew; + } + }, 3000); + } + } else if (window.location.hostname.includes("vimeo.com")) { + debug.log("[entered] vimeo.com"); + const el = await waitForElm(selectors.vimeoSelector); + if (el) { + await sleep(1000); + await translateProccessor( + document.querySelector(selectors.vimeoSelector), + "vimeo", + null + ); + } + } else if (window.location.hostname.includes("9gag.com")) { + await sleep(1000); + await translateProccessor( + document.querySelector(selectors.gagSelector), + "9gag", + null + ); + } else if (window.location.hostname.includes("coub.com")) { + await sleep(1000); + await translateProccessor( + document.querySelector(".viewer__player"), + "coub", + null + ); + } else if (window.location.hostname.includes("rutube.ru")) { + const elementSelector = window.location.pathname.includes("/play/embed") + ? "#app > div > div" + : ".video-player > div > div > div:nth-child(2)"; + + const el = await waitForElm(elementSelector); + if (el) { + await translateProccessor(el, "rutube", null); + } + } else if (window.location.hostname.includes("bilibili.com")) { + if (window.location.pathname.includes("/video/")) { + const el = await waitForElm(selectors.bilibilicomSelector); + if (el) { + await translateProccessor(el, "bilibili.com", null); + } + } else if ( + window.location.pathname.includes( + "/blackboard/webplayer/embed-old.html" + ) + ) { + const el = await waitForElm("video"); + if (el) { + await translateProccessor(el.parentElement, "bilibili.com", null); + } + } + } else if (window.location.hostname.includes("twitter.com")) { + const el = await waitForElm(selectors.twitterSelector); + if (el) { + let videoIDNew; + let videoID = getVideoId("twitter"); + await translateProccessor(el, "twitter", null); + setInterval(async () => { + videoIDNew = getVideoId("twitter"); + if (videoID !== videoIDNew) { + if (videoIDNew) { + await translateProccessor( + document.querySelector(selectors.twitterSelector), + "twitter", + null + ); + } + videoID = videoIDNew; + } + }, 3000); + } + } else if (window.location.hostname.includes("my.mail.ru")) { + const el = await waitForElm(selectors.mailSelector); + if (el) { + let videoIDNew; + let videoID = getVideoId("mail.ru"); + await translateProccessor(el, "mail.ru", null); + setInterval(async () => { + videoIDNew = getVideoId("mail.ru"); + if (videoID !== videoIDNew) { + if (videoIDNew) { + await translateProccessor( + document.querySelector(selectors.mailSelector), + "mail.ru", + null + ); + } + videoID = videoIDNew; + } + }, 3000); + } + } + } + + await initWebsite(); +} + +main().catch((e) => { + console.error(e); +}); diff --git a/src/src/indexedDB.js b/src/src/indexedDB.js new file mode 100644 index 00000000..778e7ea3 --- /dev/null +++ b/src/src/indexedDB.js @@ -0,0 +1,349 @@ +import { lang } from "./menu.js"; +import { translations } from "./config/constants.js"; + +// --- IndexedDB functions start: +const dbVersion = 2; // current db version +const settingsDefault = { + key: "settings", + autoTranslate: 0, + defaultVolume: 100, + showVideoSlider: 0, + syncVolume: 0, + autoSetVolumeYandexStyle: 1, + dontTranslateYourLang: 1, +}; // default settings for db v1 + +const valuesV2 = { + audioProxy: 0, +}; + +function openDB(name) { + return indexedDB.open(name, dbVersion); +} + +async function initDB() { + return new Promise((resolve, reject) => { + function updateVersionProccessor( + transaction, + db, + indexes, + previousIndexes = {} + ) { + // openRequest is transaction object + // indexes is object of strings with default values (used for createIndex) ex. {"name": 0} + // previousIndexes is indexes for previous version + const objectStore = transaction.objectStore("settings"); + + for (const key of Object.keys(indexes)) { + objectStore.createIndex(key, key, { unique: false }); + } + + console.log("VOT: The database has been updated"); + objectStore.transaction.oncomplete = (event) => { + const objectStore = db + .transaction("settings", "readwrite") + .objectStore("settings"); + const request = objectStore.get("settings"); + + request.onerror = (event) => { + console.error( + "VOT: Data could not be retrieved from the Database: ", + event.error + ); + reject(false); + }; + + request.onsuccess = () => { + const data = + request.result || Object.assign(settingsDefault, previousIndexes); // use data from db or reset all data + for (const key in indexes) { + data[key] = indexes[key]; + } + + const requestUpdate = objectStore.put(data); + + requestUpdate.onerror = (event) => { + console.error( + "VOT: Failed to update the Database to new version", + event.error + ); + reject(false); + }; + + requestUpdate.onsuccess = () => { + console.log( + "VOT: Standard settings of the new version have been added to the Database." + ); + resolve(true); + }; + }; + }; + } + + const openRequest = openDB("VOT"); + + openRequest.onerror = () => { + console.error( + `${translations[lang].VOTFailedInitDB}: ${openRequest.error.message}` + ); + reject(false); + }; + + openRequest.onupgradeneeded = (event) => { + const db = openRequest.result; + + db.onerror = () => { + const errorMessage = translations[lang].VOTFailedInitDB; + alert(errorMessage); + console.error(errorMessage, openRequest.error); + reject(false); + }; + + if (event.oldVersion < 1) { + // db not found + const objectStore = db.createObjectStore("settings", { + keyPath: "key", + }); + + // add indexes for 1 version (without key index) + for (const key of Object.keys(settingsDefault).filter( + (k) => k !== "key" + )) { + objectStore.createIndex(key, key, { unique: false }); + } + + console.log("VOT: Database Created"); + + objectStore.transaction.oncomplete = (event) => { + const objectStore = db + .transaction("settings", "readwrite") + .objectStore("settings"); + const request = objectStore.add(settingsDefault); + + request.onsuccess = () => { + console.log( + "VOT: Standard settings added to the Database: ", + request.result + ); + resolve(true); + }; + + request.onerror = () => { + console.log( + "VOT: Error when adding standard settings to the Database: ", + request.error + ); + reject(false); + }; + }; + } + + if (event.oldVersion < 2) { + // db is outdated (db version is 1) + updateVersionProccessor(openRequest.transaction, db, valuesV2); + } + }; + + openRequest.onsuccess = () => { + const db = openRequest.result; + db.onversionchange = () => { + db.close(); + const errorMessage = translations[lang].VOTDBNeedUpdate; + alert(errorMessage); + console.log(errorMessage); + window.location.reload(); + reject(false); + }; + resolve(true); + }; + + openRequest.onblocked = () => { + const db = openRequest.result; + const errorMessage = translations[lang].VOTDisabledForDBUpdating; + console.error(errorMessage, db); + alert(errorMessage); + reject(false); + }; + }); +} + +async function updateDB({ + autoTranslate, + defaultVolume, + showVideoSlider, + syncVolume, + autoSetVolumeYandexStyle, + dontTranslateYourLang, + audioProxy, +}) { + return new Promise((resolve, reject) => { + if ( + typeof autoTranslate === "number" || + typeof defaultVolume === "number" || + typeof showVideoSlider === "number" || + typeof syncVolume === "number" || + typeof autoSetVolumeYandexStyle === "number" || + typeof dontTranslateYourLang === "number" || + typeof audioProxy === "number" + ) { + const openRequest = openDB("VOT"); + + openRequest.onerror = () => { + const errorMessage = translations[lang].VOTFailedWriteToDB; + alert(errorMessage); + console.error(errorMessage, openRequest.error.message); + reject(false); + }; + + openRequest.onupgradeneeded = async () => { + const db = openRequest.result; + db.close(); + await initDB(); + resolve(true); + }; + + openRequest.onsuccess = () => { + const db = openRequest.result; + db.onversionchange = () => { + db.close(); + console.log( + "VOT: The database needs an update, please reload the page if it didn't happen automatically" + ); + window.location.reload(); + reject(false); + }; + + const objectStore = db + .transaction("settings", "readwrite") + .objectStore("settings"); + const request = objectStore.get("settings"); + + request.onerror = (event) => { + console.error( + "VOT: Data could not be retrieved from the Database: ", + event.error + ); + reject(false); + }; + + request.onsuccess = () => { + const data = request.result; + + if (typeof autoTranslate === "number") { + data.autoTranslate = autoTranslate; + } + + if (typeof defaultVolume === "number") { + data.defaultVolume = defaultVolume; + } + + if (typeof showVideoSlider === "number") { + data.showVideoSlider = showVideoSlider; + } + + if (typeof syncVolume === "number") { + data.syncVolume = syncVolume; + } + + if (typeof autoSetVolumeYandexStyle === "number") { + data.autoSetVolumeYandexStyle = autoSetVolumeYandexStyle; + } + + if (typeof dontTranslateYourLang === "number") { + data.dontTranslateYourLang = dontTranslateYourLang; + } + + if (typeof audioProxy === "number") { + data.audioProxy = audioProxy; + } + + const requestUpdate = objectStore.put(data); + + requestUpdate.onerror = (event) => { + console.error( + "VOT: Не удалось обновить данные в Базе Данных: ", + event.error + ); + reject(false); + }; + + requestUpdate.onsuccess = () => { + resolve(true); + }; + }; + }; + + openRequest.onblocked = () => { + const db = openRequest.result; + const errorMessage = translations[lang].VOTDisabledForDBUpdating; + console.error(errorMessage, db); + alert(errorMessage); + reject(false); + }; + } + }); +} + +async function readDB() { + return new Promise((resolve, reject) => { + const openRequest = openDB("VOT"); + + openRequest.onerror = () => { + const errorMessage = translations[lang].VOTFailedReadFromDB; + alert(errorMessage); + console.error(errorMessage, openRequest.error.message); + reject(false); + }; + + openRequest.onupgradeneeded = async () => { + const db = openRequest.result; + db.close(); + await initDB(); + resolve(true); + }; + + openRequest.onsuccess = () => { + const db = openRequest.result; + db.onversionchange = () => { + db.close(); + const errorMessage = translations[lang].VOTDBNeedUpdate; + alert(errorMessage); + console.error(errorMessage); + reject(false); + }; + + const objectStore = db.transaction("settings").objectStore("settings"); + const request = objectStore.get("settings"); + + request.onerror = (event) => { + console.error(translations[lang].VOTFailedReadFromDB, event.error); + console.error(event); + reject(false); + }; + + request.onsuccess = () => { + if (request.result === undefined) { + db.close(); + deleteDB(); + reject(false); + } + const data = request.result; + resolve(data); + }; + }; + + openRequest.onblocked = () => { + const db = openRequest.result; + const errorMessage = translations[lang].VOTDisabledForDBUpdating; + console.error(errorMessage, db); + alert(errorMessage); + reject(false); + }; + }); +} + +function deleteDB() { + indexedDB.deleteDatabase("VOT"); +} + +export { initDB, readDB, updateDB, deleteDB }; diff --git a/src/src/locales/de/headers.json b/src/src/locales/de/headers.json new file mode 100644 index 00000000..2e24e847 --- /dev/null +++ b/src/src/locales/de/headers.json @@ -0,0 +1,4 @@ +{ + "name": "[VOT] - Voice-Over-Video-Übersetzung", + "description": "Eine kleine Erweiterung, die eine Voice-over-Übersetzung von Videos aus dem Yandex-Browser zu anderen Browsern hinzufügt" +} diff --git a/src/src/locales/es/headers.json b/src/src/locales/es/headers.json new file mode 100644 index 00000000..202471cd --- /dev/null +++ b/src/src/locales/es/headers.json @@ -0,0 +1,4 @@ +{ + "name": "[VOT] - Traducción de vídeo en off", + "description": "Una pequeña extensión que agrega una traducción de voz en off de un video de Yandex Browser a otros navegadores" +} diff --git a/src/src/locales/fr/headers.json b/src/src/locales/fr/headers.json new file mode 100644 index 00000000..b19edec3 --- /dev/null +++ b/src/src/locales/fr/headers.json @@ -0,0 +1,4 @@ +{ + "name": "[VOT] - Traduction vidéo voix-off", + "description": "Une petite extension qui ajoute la traduction vocale de la vidéo du Navigateur Yandex à d'autres navigateurs" +} diff --git a/src/src/locales/it/headers.json b/src/src/locales/it/headers.json new file mode 100644 index 00000000..2eee6b43 --- /dev/null +++ b/src/src/locales/it/headers.json @@ -0,0 +1,4 @@ +{ + "name": "[VOT] - Traduzione Video fuori campo", + "description": "Una piccola estensione che aggiunge la traduzione vocale del video dal browser Yandex ad altri browser" +} diff --git a/src/src/locales/ru/headers.json b/src/src/locales/ru/headers.json new file mode 100644 index 00000000..7fdc1c8e --- /dev/null +++ b/src/src/locales/ru/headers.json @@ -0,0 +1,4 @@ +{ + "name": "[VOT] - Закадровый перевод видео", + "description": "Небольшое расширение, которое добавляет закадровый перевод видео из Яндекс Браузера в другие браузеры" +} diff --git a/src/src/locales/zh/headers.json b/src/src/locales/zh/headers.json new file mode 100644 index 00000000..d02dad6b --- /dev/null +++ b/src/src/locales/zh/headers.json @@ -0,0 +1,4 @@ +{ + "name": "[VOT] - 画外音视频翻译", + "description": "一个小扩展,它增加了视频从Yandex浏览器到其他浏览器的画外音翻译" +} diff --git a/src/src/menu.js b/src/src/menu.js new file mode 100644 index 00000000..464d2871 --- /dev/null +++ b/src/src/menu.js @@ -0,0 +1,196 @@ +import debug from "./utils/debug.js"; +import { translations } from "./config/constants.js"; + +const userlang = navigator.language || navigator.userLanguage; +let lang = userlang.substr(0, 2).toLowerCase(); +if (!(lang in translations)) { + lang = "en"; +} + +function changeBtnColor(n) { + document.querySelector(".translationBtn").style.color = n; +} + +function changeBtnState(newState = "none") { + document.querySelector(".translationBtn").dataset.state = newState; +} + +function changeIconBackground(type = "none") { + let iconBackgroundColor; + switch (type) { + case "error": + iconBackgroundColor = "#7A7A7D"; + break; + case "success": + iconBackgroundColor = "#A36EFF"; + break; + default: + iconBackgroundColor = "#FFFFFF"; + break; + } + + document.querySelector(".translateIcon").style.fill = iconBackgroundColor; +} + +function transformBtn(type = "none", text) { + switch (type) { + case "error": + changeIconBackground(type); + changeBtnColor("#7A7A7D"); + changeBtnState(type); + break; + case "success": + changeIconBackground(type); + changeBtnColor("#A36EFF"); + changeBtnState(type); + break; + default: + changeIconBackground("none"); + changeBtnColor("#FFFFFF"); + changeBtnState("none"); + break; + } + + document.querySelector(".translationBtn").innerText = text; +} + +// Add translation buttton block +function addTranslationBlock(element) { + if (!element || element.querySelector(".translationBlock")) return; + + const block = document.createElement("div"); + block.classList.add("translationBlock"); + block.innerHTML = ` + + + + + + + ${translations[lang].translateVideo} + + + + + + + `; + + element.appendChild(block); + debug.log("VOT: Added translation button to ", element); +} + +function createTranslationMenu() { + const container = document.createElement("div"); + container.classList.add("translationMenuContent"); + container.innerHTML = ` +

${translations[lang].translationSettings}

+
+
+ + + + + + +
+ `; + + container.onclick = (event) => event.stopPropagation(); + return container; +} + +// Create checkbox for menu +function createMenuCheckbox(id, valueToCheck, content) { + const checkboxContainer = document.createElement("div"); + const checkbox = document.createElement("input"); + const checkboxLabel = document.createElement("label"); + + checkbox.type = "checkbox"; + checkbox.id = id; + checkbox.checked = Boolean(valueToCheck); + + checkboxLabel.htmlFor = id; + checkboxLabel.innerHTML = content; + + checkboxContainer.classList.add("translationMenuContainer"); + checkboxContainer.appendChild(checkbox); + checkboxContainer.appendChild(checkboxLabel); + + return checkboxContainer; +} + +// Create slider for menu +function createMenuSlider(id, sliderValue, content) { + const sliderContainer = document.createElement("div"); + const slider = document.createElement("input"); + const sliderLabel = document.createElement("label"); + + slider.type = "range"; + slider.id = id; + slider.classList.add("VOTMenuSlider"); + slider.min = 0; + slider.max = 100; + slider.value = sliderValue; + + sliderLabel.htmlFor = id; + sliderLabel.classList.add("translationHeader"); + sliderLabel.innerHTML = content; + + sliderContainer.classList.add("translationMenuContainer"); + sliderContainer.appendChild(sliderLabel); + sliderContainer.appendChild(slider); + + return sliderContainer; +} + +// Create select for menu +function createMenuSelect(id, selectOptions) { + // selectOptions structure: + // [ + // { + // label: string, + // value: string, + // selected: boolean, + // disabled: boolean + // } + // ] + const selectContainer = document.createElement("div"); + const select = document.createElement("select"); + + select.id = id; + select.classList.add("VOTMenuSelect"); + + for (const option of selectOptions) { + const optionElement = document.createElement("option"); + optionElement.innerText = option.label; + optionElement.value = option.value; + if ( + Object.prototype.hasOwnProperty.call(option, "selected") && + option.selected + ) { + optionElement.setAttribute("selected", "selected"); + } + + if (Object.prototype.hasOwnProperty.call(option, "disabled")) { + optionElement.disabled = option.disabled; + } + + select.appendChild(optionElement); + } + + selectContainer.classList.add("translationMenuContainer"); + selectContainer.appendChild(select); + + return selectContainer; +} + +export { + transformBtn, + addTranslationBlock, + createTranslationMenu, + createMenuCheckbox, + createMenuSlider, + createMenuSelect, + lang, +}; diff --git a/src/src/rvt-cloudflare.js b/src/src/rvt-cloudflare.js new file mode 100644 index 00000000..1e444cce --- /dev/null +++ b/src/src/rvt-cloudflare.js @@ -0,0 +1,87 @@ +import { getUUID } from "./getUUID.js"; +import { yandexRequests } from "./yandexRequests.js"; +import { workerHost, yandexHmacKey } from "./config/config-cloudflare.js"; +import { yandexUserAgent } from "./config/config.js"; +import debug from "./utils/debug.js"; + +// Request video translation from Yandex API +async function requestVideoTranslation( + url, + unknown1, + requestLang, + responseLang, + callback +) { + // Initialize variables + let response; + let responseBody; + const deviceId = getUUID(true); + const body = yandexRequests.encodeRequest( + url, + deviceId, + unknown1, + requestLang, + responseLang + ); + + try { + debug.log("requestVideoTranslation"); + // Create a key from the HMAC secret + const utf8Encoder = new TextEncoder("utf-8"); + const key = await window.crypto.subtle.importKey( + "raw", + utf8Encoder.encode(yandexHmacKey), + { name: "HMAC", hash: { name: "SHA-256" } }, + false, + ["sign", "verify"] + ); + // Sign the body with the key + const signature = await window.crypto.subtle.sign("HMAC", key, body); + // Convert the signature to a hex string + const hexSignature = Array.from(new Uint8Array(signature), (x) => + x.toString(16).padStart(2, "0") + ).join(""); + // Create a fetch options object with headers and body + const options = { + method: "POST", + mode: "cors", + cache: "no-cache", + headers: { + "Content-Type": "application/json", + }, + redirect: "follow", + referrerPolicy: "no-referrer", + body: JSON.stringify({ + headers: { + Accept: "application/x-protobuf", + "Accept-Language": "en", + "Content-Type": "application/x-protobuf", + "User-Agent": yandexUserAgent, + Pragma: "no-cache", + "Cache-Control": "no-cache", + "Sec-Fetch-Mode": "no-cors", + "Vtrans-Signature": hexSignature, + "Sec-Vtrans-Token": getUUID(false), + }, + body: String.fromCharCode(...body), + }), + }; + // Fetch the translation from the worker host + response = await fetch( + `https://${workerHost}/video-translation/translate`, + options + ); + // Get the response body as an array buffer + responseBody = await response.arrayBuffer(); + } catch (exception) { + debug.log(exception); + // Handle errors + response = { status: -1 }; + responseBody = exception; + } + + // Call the callback function with the result + callback(response.status == 200, responseBody); +} + +export default requestVideoTranslation; diff --git a/src/src/rvt.js b/src/src/rvt.js new file mode 100644 index 00000000..8c2d99dd --- /dev/null +++ b/src/src/rvt.js @@ -0,0 +1,78 @@ +import { getUUID } from "./getUUID.js"; +import { yandexRequests } from "./yandexRequests.js"; +import { workerHost, yandexHmacKey, yandexUserAgent } from "./config/config.js"; + +// Request video translation from Yandex API +async function requestVideoTranslation( + url, + unknown1, + requestLang, + responseLang, + callback +) { + // Initialize variables + const deviceId = getUUID(true); + const body = yandexRequests.encodeRequest( + url, + deviceId, + unknown1, + requestLang, + responseLang + ); + + try { + // Create a key from the HMAC secret + const utf8Encoder = new TextEncoder("utf-8"); + const key = await window.crypto.subtle.importKey( + "raw", + utf8Encoder.encode(yandexHmacKey), + { name: "HMAC", hash: { name: "SHA-256" } }, + false, + ["sign", "verify"] + ); + // Sign the body with the key + const signature = await window.crypto.subtle.sign("HMAC", key, body); + // Convert the signature to a hex string + const hexSignature = Array.from(new Uint8Array(signature), (x) => + x.toString(16).padStart(2, "0") + ).join(""); + // Create a fetch options object with headers and body + const options = { + // url: `https://${workerHost}/stream-translation/whitelist-stream`, + // url: `https://${workerHost}/stream-translation/translate-stream`, + url: `https://${workerHost}/video-translation/translate`, + method: "POST", + headers: { + Accept: "application/x-protobuf", + "Accept-Language": "en", + "Content-Type": "application/x-protobuf", + "User-Agent": yandexUserAgent, + Pragma: "no-cache", + "Cache-Control": "no-cache", + "Sec-Fetch-Mode": "no-cors", + "sec-ch-ua": null, + "sec-ch-ua-mobile": null, + "sec-ch-ua-platform": null, + "Vtrans-Signature": hexSignature, + "Sec-Vtrans-Token": getUUID(false), + }, + data: String.fromCharCode(...body), + responseType: "arraybuffer", + }; + // Send the request using GM_xmlhttpRequest + GM_xmlhttpRequest({ + ...options, + onload: (http) => { + callback(http.status === 200, http.response); + }, + onerror: (error) => { + callback(false); + }, + }); + } catch (exception) { + // Handle errors + callback(false); + } +} + +export default requestVideoTranslation; diff --git a/src/src/styles/main.css b/src/src/styles/main.css new file mode 100644 index 00000000..189531e6 --- /dev/null +++ b/src/src/styles/main.css @@ -0,0 +1,247 @@ +.translationBlock { + padding: 0.45rem !important; + width: max-content; + position: absolute; + background: #2e2f34; + border-radius: 0.5rem !important; + left: 50%; + top: 5rem; + transform: translate(-50%); + text-align: center; + opacity: 0; + transition: opacity 1s; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + z-index: 100; +} + +.translationBtn { + position: relative; + display: inline-block; + vertical-align: middle; + color: #fff; + padding-right: 0.25rem !important; + cursor: pointer; + font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif; +} + +.translationBlock:hover { + opacity: 1; +} + +.translationMenu { + display: inline-block; + vertical-align: middle; + border-left: 1px solid #424348; + max-height: 16px; + max-width: 24px; + cursor: pointer; +} + +.translationMenuIcon { + padding: 0 10px !important; + width: 24px; +} + +.translationIAlice { + display: inline-block; + vertical-align: middle; + max-height: 26px; + max-width: 50px; +} + +.translationIconAlice { + height: 24px !important; + width: 24px !important; +} + +.translationITranslate { + display: inline-block; + vertical-align: middle; + max-height: 20px; + max-width: 20px; +} + +.translationMenuContent { + position: absolute; + background: #2e2f34; + color: #fff; + display: none; + border-radius: 1rem !important; + left: 50%; + top: 10rem; + transform: translate(-50%); + text-align: left; + font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important; + + width: 300px; + /* height: 375px; */ + opacity: 0; + z-index: 100; + transition: opacity 0.5s ease; +} + +.VOTMenuSlider { + -webkit-appearance: none !important; + appearance: none !important; + width: 268px !important; + height: 8px !important; + outline: none !important; + margin-top: 0.5rem; + opacity: 0.7; + /* background: #3C3F4D !important; */ + background: rgb(253, 222, 85, 0.6) !important; + border: none !important; + border-radius: 2rem !important; + -webkit-transition: 0.2s !important; + transition: opacity 0.2s ease !important; +} + +.VOTMenuSlider:hover { + opacity: 1; +} + +.VOTMenuSlider::-webkit-slider-thumb { + -webkit-appearance: none !important; + appearance: none !important; + width: 10px !important; + height: 10px !important; + border-radius: 50% !important; + border: none !important; + background: #fff !important; + cursor: pointer !important; +} + +.VOTMenuSlider::-moz-range-thumb { + width: 10px !important; + height: 10px !important; + border-radius: 50% !important; + border: none !important; + background: #fff !important; + cursor: pointer !important; +} + +.VOTMenuSlider::-ms-thumb { + width: 10px !important; + height: 10px !important; + border-radius: 50% !important; + border: none !important; + background: #fff !important; + cursor: pointer !important; +} + +.VOTMenuSlider::-ms-fill-lower { + height: 8px !important; + border-radius: 2rem !important; + background: linear-gradient( + 90.1deg, + rgba(186, 153, 244, 0.85) -5.78%, + rgba(236, 138, 202, 0.7) 56.46%, + rgba(239, 168, 117, 0.6) 108.93% + ) !important; +} + +.VOTMenuSlider::-moz-range-progress { + height: 8px !important; + border-radius: 2rem !important; + background: linear-gradient( + 90.1deg, + rgba(186, 153, 244, 0.85) -5.78%, + rgba(236, 138, 202, 0.7) 56.46%, + rgba(239, 168, 117, 0.6) 108.93% + ) !important; +} + +.translationHeader { + padding-bottom: 0.5rem !important; +} + +.translationMainHeader { + margin: 16px !important; + color: #fff; + font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important; +} + +.translationMenuOptions { + display: flex; + flex-flow: column wrap; +} + +.translationMenuContainer { + /* width: 100%; */ + padding-left: 16px !important; + padding-top: 5px !important; + display: inline-block !important; +} + +.translationMenuContainer > input { + appearance: auto !important; + vertical-align: text-bottom; +} + +.translationMenuText { + color: #fff; + display: inline-flex; + width: 80%; +} + +.translationVolumeBox, +.translationVideoVolumeBox { + padding-top: 0.5rem !important; +} + +.translationDropDB { + border: none !important; + border-radius: 4px !important; + background: #5426ff !important; + color: #fff !important; + padding: 6px 16px !important; + margin-left: auto !important; + cursor: pointer !important; +} + +.translationDownload { + background: #5426ff !important; + color: #fff !important; + padding: 2px 10px !important; + border-radius: 4px !important; + cursor: pointer; + display: none; +} + +.translationMenuFunctional { + display: flex; + margin: 16px !important; +} + +.VOTMenuSelect { + width: 110px; + border-radius: 5px !important; + border: 1px solid #dadce0 !important; + box-shadow: 0 1px 3px -2px #9098a9; + box-sizing: border-box !important; + color: #2e2f34 !important; + background: #fff !important; + padding: 5px !important; +} + +.VOTMenuSelect:focus { + outline: none; +} + +.VOTMenuSelect:focus { + outline: none; + border-color: #0077ff; + box-shadow: 0 0 0 2px rgba(#0077ff, 0.2); +} + +#VOTSelectLanguages { + display: flex !important; + margin-left: 5px; +} + +#VOTSelectLanguages svg { + margin: 0 5px; +} diff --git a/src/src/utils/debug.js b/src/src/utils/debug.js new file mode 100644 index 00000000..855eeee3 --- /dev/null +++ b/src/src/utils/debug.js @@ -0,0 +1,33 @@ +import { translations } from "../config/constants.js"; + +const debug = {}; +debug.log = (...text) => { + if (!DEBUG_MODE) { + return; + } + return console.log( + "%c[VOT DEBUG]", + "background: #F2452D; color: #fff; padding: 5px;", + ...text + ); +}; + +debug.translations = (testLang) => { + if (!DEBUG_MODE) { + return; + } + // for add indexes + const testedTranslations = Object.entries(translations[testLang]).map( + ([key, value]) => ({ + phrase: key, + translated: value, + }) + ); + testedTranslations.unshift({ + phrase: "language_code (debug only)", + translated: testLang, + }); + return console.table(testedTranslations); +}; + +export default debug; diff --git a/src/src/utils/getYTVideoData.js b/src/src/utils/getYTVideoData.js new file mode 100644 index 00000000..e41d4009 --- /dev/null +++ b/src/src/utils/getYTVideoData.js @@ -0,0 +1,66 @@ +async function detect(cleanText) { + const response = await fetch("https://rust-server-531j.onrender.com/detect", { + method: "POST", + body: cleanText, + }); + return await response.text(); +} + +// Get the language code from the response or the text +async function getLanguage(player, response, title, description, author) { + if (!window.location.hostname.includes("m.youtube.com")) { + // ! Experimental ! get lang from selected audio track if availabled + const audioTracks = player.getAudioTrack(); + const trackInfo = audioTracks?.getLanguageInfo(); // get selected track info (id === "und" if tracks are not available) + if (trackInfo?.id !== "und") { + return trackInfo.id.split(".")[0]; + } + } + + // TODO: If the audio tracks will work fine, transfer the receipt of captions to the audioTracks variable + // Check if there is an automatic caption track in the response + const captionTracks = + response?.captions?.playerCaptionsTracklistRenderer?.captionTracks; + if (captionTracks?.length) { + const autoCaption = captionTracks.find((caption) => caption.kind === "asr"); + if (autoCaption) { + return autoCaption.languageCode; + } + } + // If there is no caption track, use detect to get the language code from the text + const text = [title, description, author].join(" "); + // Remove anything that is not a letter or a space in any language + const cleanText = text + .replace(/https?:\/\/\S+/g, "") + .replace(/[^\p{L}\s]/gu, "") + .trim() + .slice(0, 250); + return await detect(cleanText); +} + +// Get the video data from the player +async function getYTVideoData() { + const player = document.querySelector("#movie_player"); + const data = player.getVideoData(); + const response = player.getPlayerResponse(); + const { isLive, isPremiere, title, author } = data; + const { shortDescription: description } = response?.videoDetails ?? {}; + const videoData = { + isLive, + isPremiere, + title, + description, + author, + detectedLanguage: await getLanguage( + player, + response, + title, + description, + author + ), + }; + console.log("VOT Detected language: ", videoData.detectedLanguage); + return videoData; +} + +export { getYTVideoData }; diff --git a/src/src/utils/regex.js b/src/src/utils/regex.js new file mode 100644 index 00000000..352a9ad2 --- /dev/null +++ b/src/src/utils/regex.js @@ -0,0 +1,11 @@ +const cyrillicRegex = /[а-яА-ЯёЁ]/; + +function checkCyrillic(string) { + return cyrillicRegex.test(string); +} + +function getCyrillicCount(string) { + return string.match(cyrillicRegex).length; +} + +export { checkCyrillic, getCyrillicCount }; diff --git a/src/src/utils/utils.js b/src/src/utils/utils.js new file mode 100644 index 00000000..8a0d7d6f --- /dev/null +++ b/src/src/utils/utils.js @@ -0,0 +1,168 @@ +import { translations } from "../config/constants.js"; +import { lang } from "../menu.js"; + +if (!String.prototype.format) { + // https://stackoverflow.com/questions/610406/javascript-equivalent-to-printf-string-format + // syntax example: "is {0} function".format("format") + String.prototype.format = function () { + // store arguments in an array + var args = arguments; + // use replace to iterate over the string + // select the match and check if the related argument is present + // if yes, replace the match with the argument + return this.replace(/{(\d+)}/g, function (match, index) { + // check if the argument is present + return typeof args[index] != "undefined" ? args[index] : match; + }); + }; +} + +function waitForElm(selector) { + // https://stackoverflow.com/questions/5525071/how-to-wait-until-an-element-exists + return new Promise((resolve) => { + const element = document.querySelector(selector); + if (element) { + return resolve(element); + } + + const observer = new MutationObserver(() => { + const element = document.querySelector(selector); + if (element) { + resolve(element); + observer.disconnect(); + } + }); + + observer.observe(document.body, { + childList: true, + subtree: true, + once: true, + }); + }); +} + +const sleep = (m) => new Promise((r) => setTimeout(r, m)); + +const getVideoId = (service) => { + const url = new URL(window.location.href); + + switch (service) { + case "youtube": + return ( + url.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1] || + url.searchParams.get("v") + ); + case "vk": + if (url.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)) { + return url.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1); + } else if (url.searchParams.get("z")) { + return url.searchParams.get("z").split("/")[0]; + } else if (url.searchParams.get("oid") && url.searchParams.get("id")) { + return `video-${Math.abs( + url.searchParams.get("oid") + )}_${url.searchParams.get("id")}`; + } else { + return false; + } + case "9gag": + case "gag": + return url.pathname.match(/gag\/([^/]+)/)?.[1]; + case "twitch": + if (/^m\.twitch\.tv$/.test(window.location.hostname)) { + const linkUrl = document.head.querySelector('link[rel="canonical"]'); + return ( + linkUrl?.href.match(/videos\/([^/]+)/)?.[0] || url.pathname.slice(1) + ); + } else if (/^player\.twitch\.tv$/.test(window.location.hostname)) { + return `videos/${url.searchParams.get("video")}`; + } else if (/^clips\.twitch\.tv$/.test(window.location.hostname)) { + // get link to twitch channel (ex.: https://www.twitch.tv/xqc) + const channelLink = document.querySelector( + ".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']" + ); + if (!channelLink) { + return false; + } + + const channelName = channelLink.href.replace( + "https://www.twitch.tv/", + "" + ); + return `${channelName}/clip/${url.searchParams.get("clip")}`; + } else if (url.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)) { + return url.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]; + } else { + return url.pathname.match(/(?:videos)\/([^/]+)/)?.[0]; + } + case "tiktok": + return url.pathname.match(/video\/([^/]+)/)?.[1]; + case "vimeo": + return ( + url.pathname.match(/[^/]+\/[^/]+$/)?.[0] || + url.pathname.match(/[^/]+$/)?.[0] + ); + case "xvideos": + return url.pathname.match(/[^/]+\/[^/]+$/)?.[0]; + case "pornhub": + return ( + url.searchParams.get("viewkey") || + url.pathname.match(/embed\/([^/]+)/)?.[1] + ); + case "twitter": + return url.pathname.match(/status\/([^/]+)/)?.[1]; + case "udemy": + return url.pathname; + case "facebook": + return url.pathname; + case "rutube": + return url.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1]; + case "coub": + return url.pathname.match(/view\/([^/]+)/)?.[1]; + case "bilibili.com": + const bvid = url.searchParams.get("bvid"); + if (bvid) { + return bvid; + } else { + let vid = url.pathname.match(/video\/([^/]+)/)?.[1]; + if (vid && url.search && url.searchParams.get("p") !== null) { + vid += `/?p=${url.searchParams.get("p")}`; + } + return vid; + } + case "mail.ru": + if (url.pathname.startsWith("/v/") || url.pathname.startsWith("/mail/")) { + return url.pathname; + } else if (url.pathname.match(/video\/embed\/([^/]+)/)) { + const referer = document.querySelector( + ".b-video-controls__mymail-link" + ); + if (!referer) { + return false; + } + + return referer?.href.split("my.mail.ru")?.[1]; + } + default: + return false; + } +}; + +function secsToStrTime(secs) { + const minutes = Math.floor(secs / 60); + const seconds = Math.floor(secs % 60); + if (minutes >= 60) { + return translations[lang].translationTakeMoreThanHour; + } else if (minutes >= 10 && minutes % 10) { + return translations[lang].translationTakeApproximatelyMinutes.format( + minutes + ); + } else if (minutes == 1 || (minutes == 0 && seconds > 0)) { + return translations[lang].translationTakeAboutMinute; + } else { + return translations[lang].translationTakeApproximatelyMinute.format( + minutes + ); + } +} + +export { waitForElm, sleep, getVideoId, secsToStrTime }; diff --git a/src/src/utils/volume.js b/src/src/utils/volume.js new file mode 100644 index 00000000..8cb30e7c --- /dev/null +++ b/src/src/utils/volume.js @@ -0,0 +1,29 @@ +// element - audio / video element +function syncVolume(element, sliderVolume, otherSliderVolume, tempVolume) { + let finalValue; + if (sliderVolume > tempVolume) { + // sliderVolume = 100 + // tempVolume = 69 + // volume = 15 + // 100 - 69 = 31 + // 15 + 31 = 46 - final video volume + finalValue = otherSliderVolume + (sliderVolume - tempVolume); + finalValue = finalValue > 100 ? 100 : Math.max(finalValue, 0); + + element.volume = finalValue / 100; + } else if (sliderVolume < tempVolume) { + // sliderVolume = 69 + // tempVolume = 100 + // volume = 15 + // 100 - 69 = 31 + // 15 - 31 = 0 - final video volume + finalValue = otherSliderVolume - (tempVolume - sliderVolume); + finalValue = finalValue > 100 ? 100 : Math.max(finalValue, 0); + + element.volume = finalValue / 100; + } + + return finalValue; +} + +export { syncVolume }; diff --git a/src/src/yandexRequests.js b/src/src/yandexRequests.js new file mode 100644 index 00000000..9ea590f8 --- /dev/null +++ b/src/src/yandexRequests.js @@ -0,0 +1,97 @@ +const VideoTranslationRequest = new protobuf.Type("VideoTranslationRequest") + .add(new protobuf.Field("url", 3, "string")) + .add(new protobuf.Field("deviceId", 4, "string")) + .add(new protobuf.Field("firstRequest", 5, "bool")) // true for the first request, false for subsequent ones + .add(new protobuf.Field("unknown1", 6, "fixed64")) + .add(new protobuf.Field("unknown2", 7, "int32")) // 1 1 + .add(new protobuf.Field("language", 8, "string")) // source language code + .add(new protobuf.Field("unknown3", 9, "int32")) // 0 0 + .add(new protobuf.Field("unknown4", 10, "int32")) // 0 0 + .add(new protobuf.Field("translationHelp", 11, "int32")) // array for translation assistance ([0] -> {2: link to video, 1: "video_file_url"}, [1] -> {2: link to subtitles, 1: "subtitles_file_url"}) + .add(new protobuf.Field("responseLanguage", 14, "string")); // target language code + +// const VideoWhitelistStreamRequest = new protobuf.Type("VideoWhitelistStreamRequest") +// .add(new protobuf.Field("url", 1, "string")) +// .add(new protobuf.Field("deviceId", 4, "string")) + +// const VideoTranslationStreamRequest = new protobuf.Type("VideoTranslationStreamRequest") +// .add(new protobuf.Field("url", 1, "string")) +// .add(new protobuf.Field("language", 2, "string")) +// .add(new protobuf.Field("responseLanguage", 3, "string")) + +const VideoTranslationResponse = new protobuf.Type("VideoTranslationResponse") + .add(new protobuf.Field("url", 1, "string")) + .add(new protobuf.Field("duration", 2, "double")) + .add(new protobuf.Field("status", 4, "int32")) // status + .add(new protobuf.Field("remainingTime", 5, "int32")) // secs before translation + .add(new protobuf.Field("language", 8, "string")) // detected language (if the wrong one is set) + .add(new protobuf.Field("message", 9, "string")); +// 6 - unknown 0 (1st request) -> 10 (2nd, 3th and etc requests) +// 7 - unknown array + +// const VideoWhitelistStreamResponse = new protobuf.Type("VideoWhitelistStreamResponse") +// .add(new protobuf.Field("inWhitelist", 1, "bool")) + +// const VideoTranslationStreamResponse = new protobuf.Type("VideoTranslationStreamResponse") +// .add(new protobuf.Field("unknown1", 1, "int32")) +// .add(new protobuf.Field("array", 2, "string")) +// .add(new protobuf.Field("ping", 3, "int32")) + +// Create a root namespace and add the types +// const root = new protobuf.Root().define("yandex").add(VideoWhitelistStreamRequest).add(VideoWhitelistStreamResponse); + +// // Export the encoding and decoding functions +// export const yandexRequests = { +// encodeRequest(url, deviceId, unknown1, requestLang, responseLang) { +// return root.VideoWhitelistStreamRequest.encode({ +// url, +// deviceId: 'UCLA_DiR1FfKNvjuUpBHmylQ' +// }).finish(); +// }, +// decodeResponse(response) { +// return root.VideoWhitelistStreamResponse.decode(new Uint8Array(response)); +// } +// }; + +// // Create a root namespace and add the types +// const root = new protobuf.Root().define("yandex").add(VideoTranslationStreamRequest).add(VideoTranslationStreamResponse); + +// // Export the encoding and decoding functions +// export const yandexRequests = { +// encodeRequest(url, deviceId, unknown1, requestLang, responseLang) { +// return root.VideoTranslationStreamRequest.encode({ +// url, +// language: requestLang, +// responseLanguage: responseLang +// }).finish(); +// }, +// decodeResponse(response) { +// return root.VideoTranslationStreamResponse.decode(new Uint8Array(response)); +// } +// }; + +// Create a root namespace and add the types +const root = new protobuf.Root() + .define("yandex") + .add(VideoTranslationRequest) + .add(VideoTranslationResponse); + +// Export the encoding and decoding functions +export const yandexRequests = { + encodeRequest(url, deviceId, unknown1, requestLang, responseLang) { + return root.VideoTranslationRequest.encode({ + url, + deviceId, + firstRequest: true, + unknown1, + unknown2: 1, + language: requestLang, + unknown3: 0, + unknown4: 0, + responseLanguage: responseLang, + }).finish(); + }, + decodeResponse(response) { + return root.VideoTranslationResponse.decode(new Uint8Array(response)); + }, +}; From d9157e1cbb7b00face62458fa80478845baa2354 Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Sat, 22 Jul 2023 08:57:31 +0400 Subject: [PATCH 05/48] Delete src/src directory --- src/src/config/alternativeUrls.js | 52 - src/src/config/config-cloudflare.js | 5 - src/src/config/config.js | 8 - src/src/config/constants.js | 400 -------- src/src/config/regexes.js | 7 - src/src/config/selectors.js | 17 - src/src/getUUID.js | 11 - src/src/headers.json | 75 -- src/src/index.js | 1451 --------------------------- src/src/indexedDB.js | 349 ------- src/src/locales/de/headers.json | 4 - src/src/locales/es/headers.json | 4 - src/src/locales/fr/headers.json | 4 - src/src/locales/it/headers.json | 4 - src/src/locales/ru/headers.json | 4 - src/src/locales/zh/headers.json | 4 - src/src/menu.js | 196 ---- src/src/rvt-cloudflare.js | 87 -- src/src/rvt.js | 78 -- src/src/styles/main.css | 247 ----- src/src/utils/debug.js | 33 - src/src/utils/getYTVideoData.js | 66 -- src/src/utils/regex.js | 11 - src/src/utils/utils.js | 168 ---- src/src/utils/volume.js | 29 - src/src/yandexRequests.js | 97 -- 26 files changed, 3411 deletions(-) delete mode 100644 src/src/config/alternativeUrls.js delete mode 100644 src/src/config/config-cloudflare.js delete mode 100644 src/src/config/config.js delete mode 100644 src/src/config/constants.js delete mode 100644 src/src/config/regexes.js delete mode 100644 src/src/config/selectors.js delete mode 100644 src/src/getUUID.js delete mode 100644 src/src/headers.json delete mode 100644 src/src/index.js delete mode 100644 src/src/indexedDB.js delete mode 100644 src/src/locales/de/headers.json delete mode 100644 src/src/locales/es/headers.json delete mode 100644 src/src/locales/fr/headers.json delete mode 100644 src/src/locales/it/headers.json delete mode 100644 src/src/locales/ru/headers.json delete mode 100644 src/src/locales/zh/headers.json delete mode 100644 src/src/menu.js delete mode 100644 src/src/rvt-cloudflare.js delete mode 100644 src/src/rvt.js delete mode 100644 src/src/styles/main.css delete mode 100644 src/src/utils/debug.js delete mode 100644 src/src/utils/getYTVideoData.js delete mode 100644 src/src/utils/regex.js delete mode 100644 src/src/utils/utils.js delete mode 100644 src/src/utils/volume.js delete mode 100644 src/src/yandexRequests.js diff --git a/src/src/config/alternativeUrls.js b/src/src/config/alternativeUrls.js deleted file mode 100644 index fcfb84f0..00000000 --- a/src/src/config/alternativeUrls.js +++ /dev/null @@ -1,52 +0,0 @@ -// Sites host Invidious. I tested the performance only on invidious.kevin.rocks, youtu.be and inv.vern.cc -const sitesInvidious = [ - "invidious.snopyta.org", - "yewtu.be", - "invidious.kavin.rocks", - "vid.puffyan.us", - "invidious.namazso.eu", - "inv.riverside.rocks", - "yt.artemislena.eu", - "invidious.flokinet.to", - "invidious.esmailelbob.xyz", - "y.com.sb", - "invidious.nerdvpn.de", - "inv.vern.cc", - "invidious.slipfox.xyz", - "invidio.xamh.de", - "invidious.dhusch.de", -]; - -// Sites host Piped. I tested the performance only on piped.video -const sitesPiped = [ - "piped.video", - "piped.tokhmi.xyz", - "piped.moomoo.me", - "piped.syncpundit.io", - "piped.mha.fi", - "watch.whatever.social", - "piped.garudalinux.org", - "efy.piped.pages.dev", - "watch.leptons.xyz", - "piped.lunar.icu", - "yt.dc09.ru", - "piped.mint.lgbt", - "il.ax", - "piped.privacy.com.de", - "piped.esmailelbob.xyz", - "piped.projectsegfau.lt", - "piped.in.projectsegfau.lt", - "piped.us.projectsegfau.lt", - "piped.privacydev.net", - "piped.palveluntarjoaja.eu", - "piped.smnz.de", - "piped.adminforge.de", - "piped.qdi.fi", - "piped.hostux.net", - "piped.chauvet.pro", - "piped.jotoma.de", - "piped.pfcd.me", - "piped.frontendfriendly.xyz", -]; - -export { sitesInvidious, sitesPiped }; diff --git a/src/src/config/config-cloudflare.js b/src/src/config/config-cloudflare.js deleted file mode 100644 index 99c7727f..00000000 --- a/src/src/config/config-cloudflare.js +++ /dev/null @@ -1,5 +0,0 @@ -// CLOUDFLARE CONFIGURATION -const workerHost = "vot.toil-dump.workers.dev"; -const yandexHmacKey = "gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"; - -export { workerHost, yandexHmacKey }; diff --git a/src/src/config/config.js b/src/src/config/config.js deleted file mode 100644 index beb5726b..00000000 --- a/src/src/config/config.js +++ /dev/null @@ -1,8 +0,0 @@ -// CONFIGURATION -const workerHost = "api.browser.yandex.ru"; -const yandexHmacKey = "gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"; -const yandexUserAgent = - "Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1"; -const autoVolume = 0.15; // 0.0 - 1.0 (0% - 100%) - default volume of the video with the translation - -export { workerHost, yandexHmacKey, yandexUserAgent, autoVolume }; diff --git a/src/src/config/constants.js b/src/src/config/constants.js deleted file mode 100644 index 3cc50e31..00000000 --- a/src/src/config/constants.js +++ /dev/null @@ -1,400 +0,0 @@ -const translateFuncParam = 0x40_75_50_00_00_00_00_00; -const availableLangs = { - ru: "Russian", - en: "English", - zh: "Chinese", - fr: "French", - it: "Italian", - es: "Spanish", - de: "German", -}; // available languages for translation -const siteTranslates = { - youtube: "https://youtu.be/", - twitch: "https://twitch.tv/", - vimeo: "https://vimeo.com/", - "9gag": "https://9gag.com/gag/", - vk: "https://vk.com/video?z=", - xvideos: "https://www.xvideos.com/", - pornhub: "https://rt.pornhub.com/view_video.php?viewkey=", - udemy: "https://www.udemy.com", - twitter: "https://twitter.com/i/status/", - facebook: "https://www.facebook.com/", - rutube: "https://rutube.ru/video/", - "bilibili.com": "https://www.bilibili.com/video/", - "mail.ru": "https://my.mail.ru/", - coub: "https://coub.com/view/", -}; -const translations = { - ru: { - recommended: "рекомендуется", - translateVideo: "Перевести видео", - disableTranslate: "Выключить", - translationSettings: "Настройки перевода", - resetSettings: "Сбросить настройки", - videoBeingTranslated: "Видео переводится", - videoLanguage: "Язык видео", - translationLanguage: "Язык перевода", - translationTake: "Перевод займёт", - translationTakeMoreThanHour: "Перевод займёт больше часа", - translationTakeAboutMinute: "Перевод займёт около минуты", - translationTakeFewMinutes: "Перевод займёт несколько минут", - translationTakeApproximatelyMinutes: "Перевод займёт примерно {0} минут", - translationTakeApproximatelyMinute: "Перевод займёт примерно {0} минуты", - unSupportedExtensionError: `Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`, - requestTranslationFailed: "Не удалось запросить перевод видео", - audioNotReceived: "Не получена ссылка на аудио", - grantPermissionToAutoPlay: "Предоставьте разрешение на автовоспроизведение", - neededAdditionalExtension: - "Для поддержки этого сайта необходимо дополнительное расширение", - audioFormatNotSupported: "Формат аудио не поддерживается", - VOTAutoTranslate: "Переводить при открытии", - VOTDontTranslateYourLang: "Не переводить с родного языка", - VOTVolume: "Громкость видео", - VOTVolumeTranslation: "Громкость перевода", - VOTAutoSetVolume: "Уменьшать громкость видео до ", - VOTShowVideoSlider: "Слайдер громкости видео", - VOTSyncVolume: "Связать громкость перевода и видео", - VOTAudioProxy: "Проксировать полученное аудио", - VOTDisableFromYourLang: "VOT: Вы отключили перевод видео на вашем языке", - VOTLiveNotSupported: - "VOT: Не поддерживается перевод трансляций в прямом эфире", - VOTPremiere: "VOT: Дождитесь окончания премьеры перед переводом", - VOTVideoIsTooLong: "VOT: Видео слишком длинное", - VOTNoVideoIDFound: "VOT: Не найдено ID видео", - VOTFailedInitDB: "VOT: Не удалось инициализовать базу данных", - VOTDBNeedUpdate: - "VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу", - VOTDisabledForDBUpdating: `VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`, - VOTFailedWriteToDB: "VOT: Не удалось записать данные в базу данных", - VOTFailedReadFromDB: "VOT: Не удалось получить данные из базы данных", - Russian: "Русский", - English: "Английский", - Chinese: "Китайский", - French: "Французский", - Italian: "Итальянский", - Spanish: "Испанский", - German: "Немецкий", - }, - en: { - recommended: "recommended", - translateVideo: "Translate video", - disableTranslate: "Turn off", - translationSettings: "Translation settings", - resetSettings: "Reset settings", - videoBeingTranslated: "The video is being translated", - videoLanguage: "Video language", - translationLanguage: "Translation language", - translationTake: "The translation will take", - translationTakeMoreThanHour: "The translation will take more than an hour", - translationTakeAboutMinute: "The translation will take about a minute", - translationTakeFewMinutes: "The translation will take a few minutes", - translationTakeApproximatelyMinutes: - "The translation will take approximately {0} minutes", - translationTakeApproximatelyMinute: - "The translation will take approximately {0} minutes", - unSupportedExtensionError: `Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`, - requestTranslationFailed: "Failed to request video translation", - audioNotReceived: "Audio link not received", - grantPermissionToAutoPlay: "Grant permission to autoplay", - neededAdditionalExtension: - "An additional extension is needed to support this site", - audioFormatNotSupported: "The audio format is not supported", - VOTAutoTranslate: "Translate on open", - VOTDontTranslateYourLang: "Do not translate from my language", - VOTVolume: "Video volume", - VOTVolumeTranslation: "Translation Volume", - VOTAutoSetVolume: "Reduce video volume to ", - VOTShowVideoSlider: "Video volume slider", - VOTSyncVolume: "Link translation and video volume", - VOTAudioProxy: "Proxy received audio", - VOTDisableFromYourLang: - "VOT: You have disabled the translation of the video in your language", - VOTLiveNotSupported: "VOT: Translation of live streams is not supported", - VOTPremiere: "VOT: Wait for the premiere to end before translating", - VOTVideoIsTooLong: "VOT: Video is too long", - VOTNoVideoIDFound: "VOT: No video ID found", - VOTFailedInitDB: "VOT: Failed to initialize database", - VOTDBNeedUpdate: - "VOT: The database needs an update, please reload the page", - VOTDisabledForDBUpdating: `VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`, - VOTFailedWriteToDB: "VOT: Data could not be written to the database", - VOTFailedReadFromDB: "VOT: Data could not be retrieved from the database", - Russian: "Russian", - English: "English", - Chinese: "Chinese", - French: "French", - Italian: "Italian", - Spanish: "Spanish", - German: "German", - }, - zh: { - recommended: "推荐使用", - translateVideo: "翻译视频", - disableTranslate: "关掉", - translationSettings: "翻译需要一个多小时", - resetSettings: "重置设置", - videoBeingTranslated: "视频正在翻译中", - videoLanguage: "视频语言", - translationLanguage: "翻译语言", - translationTake: "翻译将采取", - translationTakeMoreThanHour: "翻译将采取一个多小时", - translationTakeAboutMinute: "翻译将采取一分钟", - translationTakeFewMinutes: "翻译将采取几分钟", - translationTakeApproximatelyMinutes: "翻译将采取大约需要{0}分钟", - translationTakeApproximatelyMinute: "翻译将采取大约需要{0}分钟", - unSupportedExtensionError: `错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`, - requestTranslationFailed: "请求视频翻译失败", - audioNotReceived: "未收到音频链接", - grantPermissionToAutoPlay: "授予自动播放权限", - neededAdditionalExtension: "需要一个额外的扩展来支持这个网站", - audioFormatNotSupported: "不支持音频格式", - VOTAutoTranslate: "打开时翻译", - VOTDontTranslateYourLang: "不要从你的语言翻译过来", - VOTVolume: "视频量", - VOTVolumeTranslation: "翻译量", - VOTAutoSetVolume: "将视频音量降低到", - VOTShowVideoSlider: "视频音量滑块", - VOTSyncVolume: "链接翻译和视频音量", - VOTAudioProxy: "代理接收的音频", - VOTDisableFromYourLang: "VOT:你已经禁用了你的语言的视频翻译", - VOTLiveNotSupported: "VOT:不支持直播流的翻译", - VOTPremiere: "VOT:等待首映结束后再翻译", - VOTVideoIsTooLong: "VOT:视频太长", - VOTNoVideoIDFound: "VOT: 没有找到视频ID", - VOTFailedInitDB: "VOT: 初始化数据库失败", - VOTDBNeedUpdate: "VOT: 数据库需要更新,请重新加载页面", - VOTDisabledForDBUpdating: `VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`, - VOTFailedWriteToDB: "VOT: 无法将数据写入数据库", - VOTFailedReadFromDB: "VOT: 无法从数据库中检索数据", - Russian: "俄语", - English: "英语", - Chinese: "中文", - French: "法语", - Italian: "意大利语", - Spanish: "西班牙语", - German: "德语", - }, - de: { - recommended: "es wird empfohlen", - translateVideo: "Video übersetzen", - disableTranslate: "Ausschalten", - translationSettings: "Übersetzungseinstellungen", - resetSettings: "Einstellungen zurücksetzen", - videoBeingTranslated: "Das Video wird übersetzt", - videoLanguage: "Sprache Video", - translationLanguage: "Zielsprache", - translationTake: "Die Übersetzung dauert", - translationTakeMoreThanHour: "Die Übersetzung dauert mehr als eine Stunde", - translationTakeAboutMinute: "Die Übersetzung dauert ungefähr eine Minute", - translationTakeFewMinutes: "Die Übersetzung dauert einige Minuten", - translationTakeApproximatelyMinutes: - "Die Übersetzung dauert ungefähr {0} Minuten", - translationTakeApproximatelyMinute: - "Die Übersetzung dauert ungefähr {0} Minuten", - unSupportedExtensionError: `Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`, - requestTranslationFailed: - "Videoübersetzung konnte nicht angefordert werden", - audioNotReceived: "Audiolink nicht empfangen", - grantPermissionToAutoPlay: - "Erteilen Sie die Berechtigung zur automatischen Wiedergabe", - neededAdditionalExtension: - "Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen", - audioFormatNotSupported: "Das Audioformat wird nicht unterstützt", - VOTAutoTranslate: "Beim Öffnen übersetzen", - VOTDontTranslateYourLang: "Nicht aus Ihrer Sprache übersetzen", - VOTVolume: "Video Lautstärke", - VOTVolumeTranslation: "Übersetzungsvolumen", - VOTAutoSetVolume: "Video-Lautstärke auf reduzieren ", - VOTShowVideoSlider: "Video-Lautstärkeregler", - VOTSyncVolume: "Übersetzungs- und Videolautstärke verknüpfen", - VOTAudioProxy: "Empfangenes Audio proxyen", - VOTDisableFromYourLang: - "VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert", - VOTLiveNotSupported: - "VOT: Übersetzung von Live-Streams wird nicht unterstützt", - VOTPremiere: - "VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen", - VOTVideoIsTooLong: "VOT: Video ist zu lang", - VOTNoVideoIDFound: "VOT: Keine Video-ID gefunden", - VOTFailedInitDB: "VOT: Datenbank konnte nicht initialisiert werden", - VOTDBNeedUpdate: - "VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu", - VOTDisabledForDBUpdating: `VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`, - VOTFailedWriteToDB: - "VOT: Daten konnten nicht in die Datenbank geschrieben werden", - VOTFailedReadFromDB: "VOT: Konnte keine Daten aus der Datenbank abrufen", - Russian: "Russisch", - English: "Englisch", - Chinese: "Chinesisch", - French: "Französisch", - Italian: "Italienisch", - Spanish: "Spanisch", - German: "Deutsch", - }, - es: { - recommended: "es recomendable", - translateVideo: "Traducir video", - disableTranslate: "Apagar", - translationSettings: "Ajustes de traducción", - resetSettings: "Restablecer ajustes", - videoBeingTranslated: "El video está siendo traducido", - videoLanguage: "Idioma del video", - translationLanguage: "Idioma de la traducción", - translationTake: "La traducción tardará", - translationTakeMoreThanHour: "La traducción tardará más de una hora", - translationTakeAboutMinute: - "La traducción tardará aproximadamente un minuto", - translationTakeFewMinutes: "La traducción tardará unos minutos", - translationTakeApproximatelyMinutes: - "La traducción tardará aproximadamente {0} minutos", - translationTakeApproximatelyMinute: - "La traducción tardará aproximadamente {0} minutos", - unSupportedExtensionError: `Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`, - requestTranslationFailed: "Error al solicitar la traducción de vídeo", - audioNotReceived: "Audiolink nicht empfangen", - grantPermissionToAutoPlay: "Conceder permiso de reproducción automática", - neededAdditionalExtension: - "Se necesita una extensión adicional para admitir este sitio", - audioFormatNotSupported: "El formato de audio no es compatible", - VOTAutoTranslate: "Traducir al abrir", - VOTDontTranslateYourLang: "No traduzca de su lengua", - VOTVolume: "Volumen de vídeo", - VOTVolumeTranslation: "Volumen de traducción", - VOTAutoSetVolume: "Reducir el volumen del video al ", - VOTShowVideoSlider: "Deslizador de volumen de video", - VOTSyncVolume: "Vincular el volumen de traducción y video", - VOTAudioProxy: "Proxificar el audio recibido", - VOTDisableFromYourLang: - "VOT: Ha desactivado la traducción del vídeo en su idioma", - VOTLiveNotSupported: - "VOT: No se admite la traducción de transmisiones en vivo", - VOTPremiere: "VOT: Espere a que termine el estreno antes de traducir", - VOTVideoIsTooLong: "VOT: El video es demasiado largo", - VOTNoVideoIDFound: "VOT: No se encontró id de video", - VOTFailedInitDB: "VOT: No se pudo inicializar la base de datos", - VOTDBNeedUpdate: - "VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página", - VOTDisabledForDBUpdating: `VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`, - VOTFailedWriteToDB: "VOT: No se pudo escribir datos en la base de datos", - VOTFailedReadFromDB: "VOT: No se pudo recuperar datos de la base de datos", - Russian: "Ruso", - English: "Inglés", - Chinese: "Chino", - French: "Francés", - Italian: "Italiano", - Spanish: "Español", - German: "Alemán", - }, - fr: { - recommended: "recommande", - translateVideo: "Traduire la vidéo", - disableTranslate: "Désactiver", - translationSettings: "Paramètres de traduction", - resetSettings: "Réinitialiser les paramètres", - videoBeingTranslated: "La vidéo est en cours de traduction", - videoLanguage: "Langue vidéo", - translationLanguage: "Langue cible", - translationTake: "La traduction prendra", - translationTakeMoreThanHour: "La traduction prendra plus d'une heure", - translationTakeAboutMinute: "La traduction prendra environ une minute", - translationTakeFewMinutes: "La traduction prendra quelques minutes", - translationTakeApproximatelyMinutes: - "La traduction prendra environ {0} minutes", - translationTakeApproximatelyMinute: - "La traduction prendra environ {0} minutes", - unSupportedExtensionError: `Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`, - requestTranslationFailed: - "Impossible de demander la traduction de la vidéo", - audioNotReceived: "Lien audio non reçu", - grantPermissionToAutoPlay: "Accorder l'autorisation de lecture automatique", - neededAdditionalExtension: - "Une extension supplémentaire est nécessaire pour prendre en charge ce site", - audioFormatNotSupported: "Format audio non pris en charge", - VOTAutoTranslate: "Traduire à l'ouverture", - VOTDontTranslateYourLang: "Ne pas traduire à partir de votre langue", - VOTVolume: "Volume de la vidéo", - VOTVolumeTranslation: "Volume de traduction", - VOTAutoSetVolume: "Réduire le volume de la vidéo à ", - VOTShowVideoSlider: "Curseur de volume vidéo", - VOTSyncVolume: "Lier le volume de la traduction et de la vidéo", - VOTAudioProxy: "Proxy audio reçu", - VOTDisableFromYourLang: - "VOT: Vous avez désactivé la traduction de la vidéo dans votre langue", - VOTLiveNotSupported: - "VOT: La traduction des flux en direct n'est pas prise en charge", - VOTPremiere: "VOT: Attendez la fin de la première avant de traduire", - VOTVideoIsTooLong: "VOT: La vidéo est trop longue", - VOTNoVideoIDFound: "VOT: ID vidéo introuvable", - VOTFailedInitDB: "VOT: Impossible d'initialiser la base de données", - VOTDBNeedUpdate: - "VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page", - VOTDisabledForDBUpdating: `VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`, - VOTFailedWriteToDB: - "VOT: Impossible d'écrire les données dans la base de données", - VOTFailedReadFromDB: - "VOT: Impossible de récupérer les données de la base de données", - Russian: "Russe", - English: "Anglais", - Chinese: "Chinois", - French: "Français", - Italian: "Italien", - Spanish: "Espagnol", - German: "Allemand", - }, - it: { - recommended: "è consigliabile", - translateVideo: "Traduci il video", - disableTranslate: "Spegnere", - translationSettings: "Impostazioni di traduzione", - resetSettings: "Ripristina impostazioni", - videoBeingTranslated: "Il video è in fase di traduzione", - videoLanguage: "Lingua Video", - translationLanguage: "Lingua di traduzione", - translationTake: "La traduzione richiederà", - translationTakeMoreThanHour: "La traduzione richiederà più di un'ora", - translationTakeAboutMinute: "La traduzione richiederà circa un minuto", - translationTakeFewMinutes: "La traduzione richiederà alcuni minuti", - translationTakeApproximatelyMinutes: - "La traduzione richiederà circa {0} minuti", - translationTakeApproximatelyMinute: - "La traduzione richiederà circa {0} minuti", - unSupportedExtensionError: `Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`, - requestTranslationFailed: "Richiesta di traduzione video non riuscita", - audioNotReceived: "Collegamento audio non ricevuto", - grantPermissionToAutoPlay: - "Concedere l'Autorizzazione per la riproduzione automatica", - neededAdditionalExtension: - "Per supportare questo sito è necessaria un'estensione aggiuntiva", - audioFormatNotSupported: "Il formato audio non è supportato", - VOTAutoTranslate: "Traduci all'apertura", - VOTDontTranslateYourLang: "Non traducete dalla vostra lingua", - VOTVolume: "Volume video", - VOTVolumeTranslation: "Volume di traduzione", - VOTAutoSetVolume: "Riduci il volume del video al ", - VOTShowVideoSlider: "Cursore del volume del video", - VOTSyncVolume: "Collega il volume della traduzione e del video", - VOTAudioProxy: "Proxy audio ricevuto", - VOTDisableFromYourLang: - "VOT: Avete disabilitato la traduzione del video nella vostra lingua", - VOTLiveNotSupported: - "VOT: La traduzione dei flussi dal vivo non è supportata", - VOTPremiere: "VOT: Aspetta che la prima finisca prima di tradurre", - VOTVideoIsTooLong: "VOT: Il video è troppo lungo", - VOTNoVideoIDFound: "VOT: ID video non trovato", - VOTFailedInitDB: "VOT: Impossibile inizializzare il database", - VOTDBNeedUpdate: - "VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina", - VOTDisabledForDBUpdating: `VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`, - VOTFailedWriteToDB: "VOT: Impossibile scrivere dati nel database", - VOTFailedReadFromDB: "VOT: Impossibile recuperare i dati dal database", - Russian: "Russo", - English: "Inglese", - Chinese: "Cinese", - French: "Francese", - Italian: "Italiano", - Spanish: "Spagnolo", - German: "Tedesco", - }, -}; - -export { translateFuncParam, availableLangs, siteTranslates, translations }; diff --git a/src/src/config/regexes.js b/src/src/config/regexes.js deleted file mode 100644 index 60a32093..00000000 --- a/src/src/config/regexes.js +++ /dev/null @@ -1,7 +0,0 @@ -const regexes = () => { - return { - youtubeRegex: /^(www.|m.)?youtube(-nocookie)?.com$/, - }; -}; - -export default regexes(); diff --git a/src/src/config/selectors.js b/src/src/config/selectors.js deleted file mode 100644 index d7d4b52f..00000000 --- a/src/src/config/selectors.js +++ /dev/null @@ -1,17 +0,0 @@ -const selectors = () => { - return { - youtubeSelector: ".html5-video-container", - twitchSelector: ".video-ref", - twitchMobileSelector: "main > div > section > div > div > div", - pipedSelector: ".shaka-video-container", - vkSelector: ".videoplayer_media", - twitterSelector: - 'div[data-testid="videoComponent"] > div:nth-child(1) > div', - vimeoSelector: ".player", - gagSelector: ".video-post", - bilibilicomSelector: ".bpx-player-video-wrap", - mailSelector: "#b-video-wrapper", - }; -}; - -export default selectors(); diff --git a/src/src/getUUID.js b/src/src/getUUID.js deleted file mode 100644 index eba3e252..00000000 --- a/src/src/getUUID.js +++ /dev/null @@ -1,11 +0,0 @@ -function getUUID(isLower) { - const uuid = ([1e7] + 1e3 + 4e3 + 8e3 + 1e11).replace(/[018]/g, (c) => - ( - c ^ - (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4))) - ).toString(16) - ); - return isLower ? uuid : uuid.toUpperCase(); -} - -export { getUUID }; diff --git a/src/src/headers.json b/src/src/headers.json deleted file mode 100644 index 1a7a8cab..00000000 --- a/src/src/headers.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "name": "[VOT] - Voice Over Translation", - "description": "A small extension that adds a Yandex Browser video translation to other browsers", - "version": "1.3.4-testing", - "author": "sodapng, mynovelhost, Toil, SashaXser", - "namespace": "vot", - "icon": "https://translate.yandex.ru/icons/favicon.ico", - "updateURL": "https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js", - "downloadURL": "https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js", - "supportURL": "https://github.com/ilyhalight/voice-over-translation/issues", - "homepageURL": "https://github.com/ilyhalight/voice-over-translation/issues", - "match": [ - "*://*.youtube.com/*", - "*://*.youtube-nocookie.com/*", - "*://*.twitch.tv/*", - "*://*.xvideos.com/*", - "*://*.pornhub.com/*", - "*://*.vk.com/*", - "*://*.vk.ru/*", - "*://invidious.snopyta.org/*", - "*://invidious.kavin.rocks/*", - "*://vid.puffyan.us/*", - "*://invidious.namazso.eu/*", - "*://inv.riverside.rocks/*", - "*://yt.artemislena.eu/*", - "*://invidious.flokinet.to/*", - "*://invidious.esmailelbob.xyz/*", - "*://invidious.nerdvpn.de/*", - "*://invidious.slipfox.xyz/*", - "*://invidio.xamh.de/*", - "*://invidious.dhusch.de/*", - "*://*.piped.video/*", - "*://piped.tokhmi.xyz/*", - "*://piped.moomoo.me/*", - "*://piped.syncpundit.io/*", - "*://piped.mha.fi/*", - "*://watch.whatever.social/*", - "*://piped.garudalinux.org/*", - "*://efy.piped.pages.dev/*", - "*://watch.leptons.xyz/*", - "*://piped.lunar.icu/*", - "*://yt.dc09.ru/*", - "*://piped.mint.lgbt/*", - "*://*.il.ax/*", - "*://piped.privacy.com.de/*", - "*://piped.esmailelbob.xyz/*", - "*://piped.projectsegfau.lt/*", - "*://piped.in.projectsegfau.lt/*", - "*://piped.us.projectsegfau.lt/*", - "*://piped.privacydev.net/*", - "*://piped.palveluntarjoaja.eu/*", - "*://piped.smnz.de/*", - "*://piped.adminforge.de/*", - "*://piped.qdi.fi/*", - "*://piped.hostux.net/*", - "*://piped.chauvet.pro/*", - "*://piped.jotoma.de/*", - "*://piped.pfcd.me/*", - "*://piped.frontendfriendly.xyz/*", - "*://*.yewtu.be/*", - "*://inv.vern.cc/*", - "*://*.vimeo.com/*", - "*://*.9gag.com/*", - "*://*.twitter.com/*", - "*://*.facebook.com/*", - "*://*.rutube.ru/*", - "*://*.bilibili.com/*", - "*://my.mail.ru/*" - ], - "require": [ - "https://cdnjs.cloudflare.com/ajax/libs/protobufjs/7.2.3/protobuf.min.js" - ], - "grant": ["GM_xmlhttpRequest", "GM_info"], - "connect": ["api.browser.yandex.ru"] -} diff --git a/src/src/index.js b/src/src/index.js deleted file mode 100644 index 05c7ba90..00000000 --- a/src/src/index.js +++ /dev/null @@ -1,1451 +0,0 @@ -import "./styles/main.css"; -import { getYTVideoData } from "./utils/getYTVideoData.js"; -import { yandexRequests } from "./yandexRequests.js"; -import { waitForElm, getVideoId, sleep, secsToStrTime } from "./utils/utils.js"; -import { autoVolume } from "./config/config.js"; -import { sitesInvidious, sitesPiped } from "./config/alternativeUrls.js"; -import { - translateFuncParam, - availableLangs, - siteTranslates, - translations, -} from "./config/constants.js"; -import { initDB, readDB, updateDB, deleteDB } from "./indexedDB.js"; -import { - transformBtn, - addTranslationBlock, - createTranslationMenu, - createMenuCheckbox, - createMenuSlider, - createMenuSelect, - lang, -} from "./menu.js"; -import { syncVolume } from "./utils/volume.js"; -import { workerHost } from "./config/config-cloudflare.js"; -import regexes from "./config/regexes.js"; -import selectors from "./config/selectors.js"; -import debug from "./utils/debug.js"; - -const sitesChromiumBlocked = [...sitesInvidious, ...sitesPiped]; - -// translate properties -let translateFromLang = "en"; // default language of video - -let translateToLang = "ru"; // default language of audio response - -let ytData = ""; - -async function main() { - debug.log("Loading extension..."); - debug.log(`Selected menu language: ${lang}`); - // test all translations in console - // debug.translations('ru'); - // debug.translations('en'); - // debug.translations('de'); - // debug.translations('zh'); - // debug.translations('es'); - // debug.translations('fr'); - // debug.translations('it'); - - const rvt = await import( - `./rvt${BUILD_MODE === "cloudflare" ? "-cloudflare" : ""}.js` - ); - - const requestVideoTranslation = rvt.default; - - debug.log("Inited requestVideoTranslation..."); - - if ( - BUILD_MODE !== "cloudflare" && - GM_info?.scriptHandler && - ["Violentmonkey", "FireMonkey", "Greasemonkey", "AdGuard"].includes( - GM_info.scriptHandler - ) - ) { - const errorText = translations[lang].unSupportedExtensionError; - console.error(errorText); - return alert(errorText); - } - - debug.log("Extension compatibility passed..."); - - let timer; - const audio = new Audio(); - let opacityRatio = 0.9; - let openedMenu = false; - - if (BUILD_MODE === "cloudflare") { - var translationPanding = false; - } - - function logout(n) { - if (openedMenu) return; - - document.querySelector(".translationBlock").style.opacity = n; - } - - function resetTimer() { - clearTimeout(timer); - logout(1); - timer = setTimeout(() => { - logout(0); - }, 2000); - } - - function changeOpacityOnEvent(event, timer, opacityRatio) { - clearTimeout(timer); - logout(opacityRatio); - event.stopPropagation(); - } - - const deleteAudioSrc = () => { - audio.src = ""; - audio.removeAttribute("src"); - }; - - // Add menu container - function addTranslationMenu(element) { - if (element.querySelector(".translationMenuContent")) return; - - const container = createTranslationMenu(); - element.appendChild(container); - - // click to translation menu icon - document - .querySelector(".translationMenu") - ?.addEventListener("click", (event) => { - event.stopPropagation(); - const content = document.querySelector(".translationMenuContent"); - content.style.display = openedMenu ? "none" : "block"; - content.style.opacity = opacityRatio; - openedMenu = !openedMenu; - }); - - document - .querySelector(".translationDropDB") - .addEventListener("click", (event) => { - event.stopPropagation(); - deleteDB(); - location.reload(); - }); - - debug.log("VOT: Added translation menu to ", element); - } - - function translateVideo(url, unknown1, requestLang, responseLang, callback) { - debug.log( - `Translate video (url: ${url}, unknown1: ${unknown1}, requestLang: ${requestLang}, responseLang: ${responseLang})` - ); - - if (BUILD_MODE === "cloudflare" && translationPanding) { - debug.log("translationPanding return"); - return; - } - - translationPanding = true; - - requestVideoTranslation( - url, - unknown1, - requestLang, - responseLang, - (success, response) => { - translationPanding = false; - - debug.log("[exec callback] Requesting video translation"); - if (!success) { - callback(false, translations[lang].requestTranslationFailed); - return; - } - - const translateResponse = yandexRequests.decodeResponse(response); - console.log("VOT Response: ", translateResponse); - - switch (translateResponse.status) { - case 0: - callback(false, translateResponse.message); - break; - case 1: - callback( - !!translateResponse.url, - translateResponse.url || translations[lang].audioNotReceived - ); - break; - case 2: - callback( - false, - translateResponse.remainingTime - ? secsToStrTime(translateResponse.remainingTime) - : translations[lang].translationTakeFewMinutes - ); - break; - case 3: - /* - Иногда, в ответе приходит статус код 3, но видео всё, так же, ожидает перевода. В конечном итоге, это занимает слишком много времени, - как-будто сервер не понимает, что данное видео уже недавно было переведено и заместо возвращения готовой ссылки на перевод начинает переводить видео заново при чём у него это получается за очень длительное время - */ - callback(false, translations[lang].videoBeingTranslated); - break; - } - } - ); - } - - async function translateProccessor(videoContainer, siteHostname, siteEvent) { - debug.log("[translateProccessor] execute on element: ", videoContainer); - - let video; - let autoRetry; - let volumeOnStart; - let tempOriginalVolume; - let tempVolume; - let dbAutoTranslate; - let dbDefaultVolume; - let dbShowVideoSlider; - let dbAutoSetVolumeYandexStyle; - let dontTranslateYourLang; - let dbSyncVolume; - let dbAudioProxy; // cf version only - let firstPlay = true; - let isDBInited; - - debug.log("videoContainer", videoContainer); - - video = - siteHostname === "vimeo" - ? videoContainer.querySelector( - ".vp-video-wrapper > .vp-video > .vp-telecine > video" - ) - : videoContainer.querySelector("video"); - - debug.log("video", video); - - let videoData = await getVideoData(); - console.log("VOT Video Data: ", videoData); - - const container = - siteHostname === "pornhub" && - window.location.pathname.includes("view_video.php") - ? document.querySelector(".original.mainPlayerDiv") - : siteHostname === "pornhub" && - window.location.pathname.includes("embed/") - ? document.querySelector("body") - : window.location.hostname.includes("m.youtube.com") - ? document.querySelector("#player-control-container") - : videoContainer; - - addTranslationBlock(container); - addTranslationMenu(container); - - try { - isDBInited = await initDB(); - } catch (err) { - console.error( - "[VOT] Failed to initialize database settings. All changes made will not be saved", - err - ); - } - - const menuOptions = document.querySelector(".translationMenuOptions"); - if (menuOptions && !menuOptions.querySelector("#VOTTranslateFromLang")) { - const selectFromLangOptions = [ - { - label: translations[lang].videoLanguage, - value: "default", - disabled: true, - }, - ...Object.entries(availableLangs).map(([key, value]) => ({ - label: translations[lang][value], - value: key, - selected: videoData.detectedLanguage === key, - })), - ]; - - const selectToLangOptions = [ - { - label: translations[lang].translationLanguage, - value: "default", - disabled: true, - }, - ...Object.entries(availableLangs).map(([key, value]) => ({ - label: translations[lang][value], - value: key, - selected: videoData.responseLanguage === key, - })), - ]; - - const selectFromLang = createMenuSelect( - "VOTTranslateFromLang", - selectFromLangOptions - ); - - const selectToLang = createMenuSelect( - "VOTTranslateToLang", - selectToLangOptions - ).firstElementChild; - - selectFromLang.id = "VOTSelectLanguages"; - selectFromLang.innerHTML += ` - - - - `; - - selectFromLang.appendChild(selectToLang); - menuOptions.appendChild(selectFromLang); - - menuOptions - .querySelector("#VOTTranslateFromLang") - .addEventListener("change", async (event) => { - debug.log("[onchange] select from language", event.target.value); - videoData = await setDetectedLangauge(videoData, event.target.value); - }); - - menuOptions - .querySelector("#VOTTranslateToLang") - .addEventListener("change", async (event) => { - debug.log("[onchange] select to language", event.target.value); - videoData = await setResponseLangauge(videoData, event.target.value); - }); - } - - if (isDBInited) { - const dbData = await readDB(); - if (dbData) { - dbAutoTranslate = dbData.autoTranslate; - dbDefaultVolume = dbData.defaultVolume; - dbShowVideoSlider = dbData.showVideoSlider; - dbAutoSetVolumeYandexStyle = dbData.autoSetVolumeYandexStyle; - dontTranslateYourLang = dbData.dontTranslateYourLang; - dbAudioProxy = dbData.audioProxy; // cf version only - dbSyncVolume = dbData.syncVolume; // youtube only - - debug.log("[db] data from db: ", dbData); - - if ( - dbAutoTranslate !== undefined && - menuOptions && - !menuOptions.querySelector("#VOTAutoTranslate") - ) { - const checkbox = createMenuCheckbox( - "VOTAutoTranslate", - dbAutoTranslate, - translations[lang].VOTAutoTranslate + - (siteHostname === "vk" || - window.location.hostname.includes("m.twitch.tv") - ? ` (${translations[lang].recommended})` - : "") - ); - - checkbox.querySelector("#VOTAutoTranslate").onclick = async ( - event - ) => { - event.stopPropagation(); - const value = Number(event.target.checked); - await updateDB({ autoTranslate: value }); - dbAutoTranslate = value; - debug.log( - "autoTranslate value changed. New value: ", - dbAutoTranslate - ); - }; - - menuOptions.appendChild(checkbox); - } - - if ( - window.location.hostname.includes("youtube.com") && - dontTranslateYourLang !== undefined && - menuOptions && - !menuOptions.querySelector("#VOTDontTranslateYourLang") - ) { - const checkbox = createMenuCheckbox( - "VOTDontTranslateYourLang", - dontTranslateYourLang, - translations[lang].VOTDontTranslateYourLang - ); - - checkbox.querySelector("#VOTDontTranslateYourLang").onclick = async ( - event - ) => { - event.stopPropagation(); - const value = Number(event.target.checked); - await updateDB({ dontTranslateYourLang: value }); - dontTranslateYourLang = value; - debug.log( - "dontTranslateYourLang value changed. New value: ", - dontTranslateYourLang - ); - }; - - menuOptions.appendChild(checkbox); - } - - if ( - dbAutoSetVolumeYandexStyle !== undefined && - menuOptions && - !menuOptions.querySelector("#VOTAutoSetVolume") - ) { - const checkbox = createMenuCheckbox( - "VOTAutoSetVolume", - dbAutoSetVolumeYandexStyle, - translations[lang].VOTAutoSetVolume + `${autoVolume * 100}%` - ); - - checkbox.querySelector("#VOTAutoSetVolume").onclick = async ( - event - ) => { - event.stopPropagation(); - const value = Number(event.target.checked); - await updateDB({ autoSetVolumeYandexStyle: value }); - dbAutoSetVolumeYandexStyle = value; - debug.log( - "autoSetVolumeYandexStyle value changed. New value: ", - dbAutoSetVolumeYandexStyle - ); - }; - - menuOptions.appendChild(checkbox); - } - - if ( - dbShowVideoSlider !== undefined && - menuOptions && - !menuOptions.querySelector("#VOTShowVideoSlider") - ) { - const checkbox = createMenuCheckbox( - "VOTShowVideoSlider", - dbShowVideoSlider, - translations[lang].VOTShowVideoSlider - ); - - checkbox.querySelector("#VOTShowVideoSlider").onclick = async ( - event - ) => { - event.stopPropagation(); - const value = Number(event.target.checked); - await updateDB({ showVideoSlider: value }); - dbShowVideoSlider = value; - debug.log( - "showVideoSlider value changed. New value: ", - dbShowVideoSlider - ); - if ( - dbShowVideoSlider === 1 && - document.querySelector(".translationBtn").dataset.state === - "success" - ) { - addVideoSlider(); - } else { - document.querySelector("#VOTVideoSlider")?.parentElement.remove(); - } - }; - - menuOptions.appendChild(checkbox); - } - - if ( - window.location.hostname.includes("youtube.com") && - !window.location.hostname.includes("m.youtube.com") && - dbSyncVolume !== undefined && - menuOptions && - !menuOptions.querySelector("#VOTSyncVolume") - ) { - const checkbox = createMenuCheckbox( - "VOTSyncVolume", - dbSyncVolume, - translations[lang].VOTSyncVolume - ); - - checkbox.querySelector("#VOTSyncVolume").onclick = async (event) => { - event.stopPropagation(); - const value = Number(event.target.checked); - await updateDB({ syncVolume: value }); - dbSyncVolume = value; - debug.log("syncVolume value changed. New value: ", dbSyncVolume); - }; - - menuOptions.appendChild(checkbox); - } - - // cf version only - if ( - BUILD_MODE === "cloudflare" && - dbAudioProxy !== undefined && - menuOptions && - !menuOptions.querySelector("#VOTAudioProxy") - ) { - const checkbox = createMenuCheckbox( - "VOTAudioProxy", - dbAudioProxy, - translations[lang].VOTAudioProxy - ); - - checkbox.querySelector("#VOTAudioProxy").onclick = async (event) => { - event.stopPropagation(); - const value = Number(event.target.checked); - await updateDB({ audioProxy: value }); - dbAudioProxy = value; - debug.log("audioProxy value changed. New value: ", dbAudioProxy); - }; - - menuOptions.appendChild(checkbox); - } - } - } - - transformBtn("none", translations[lang].translateVideo); - - if ( - window.location.hostname.includes("youtube.com") && - !window.location.hostname.includes("m.youtube.com") - ) { - const syncVolumeObserver = new MutationObserver(async function ( - mutations - ) { - mutations.forEach(async function (mutation) { - if ( - mutation.type === "attributes" && - mutation.attributeName === "aria-valuenow" && - document.querySelector("#VOTVideoSlider") - ) { - syncVideoVolumeSlider(); - } - }); - }); - - syncVolumeObserver.observe(document.querySelector(".ytp-volume-panel"), { - attributes: true, - childList: false, - subtree: true, - attributeOldValue: true, - }); - } - - function setSelectMenuValues(from, to = lang) { - if (!document.querySelector("#VOTSelectLanguages")) { - return; - } - console.log(`Set translation from ${from} to ${to}`); - document.querySelector("#VOTTranslateFromLang").value = from; - document.querySelector("#VOTTranslateToLang").value = to; - } - - // data - ytData or VideoData - async function setDetectedLangauge(data, videolang) { - switch (videolang) { - case "en": - data.detectedLanguage = videolang; - data.responseLanguage = lang; - break; - case "ru": - data.detectedLanguage = videolang; - data.responseLanguage = lang; - if (lang == "ru") data.responseLanguage = "en"; - break; - default: - if (!Object.keys(availableLangs).includes(videolang)) { - return setDetectedLangauge(data, "en"); - } - - data.detectedLanguage = videolang; - } - - setSelectMenuValues(data.detectedLanguage, data.responseLanguage); - - return data; - } - - // data - ytData or VideoData - async function setResponseLangauge(data, videolang) { - switch (videolang) { - case "en": - data.responseLanguage = videolang; - data.detectedLanguage = "ru"; - break; - default: - if (!Object.keys(availableLangs).includes(videolang)) { - return setResponseLangauge(data, "ru"); - } - - if (data.detectedLanguage && data.responseLanguage === lang) { - data.detectedLanguage = "en"; - } - - data.responseLanguage = videolang; - } - - setSelectMenuValues(data.detectedLanguage, data.responseLanguage); - - return data; - } - - function stopTraslate() { - // Default actions on stop translate - audio.pause(); - video.removeEventListener(".translate", stopTraslate, false); - deleteAudioSrc(); - document.querySelector("#VOTVideoSlider")?.parentElement.remove(); - document.querySelector("#VOTTranslationSlider")?.parentElement.remove(); - const downloadBtn = document.querySelector(".translationDownload"); - downloadBtn.href = ""; - downloadBtn.style.display = "none"; - transformBtn("none", translations[lang].translateVideo); - if (volumeOnStart) { - video.volume = volumeOnStart; - } - } - - function syncVideoVolumeSlider() { - // Sync volume slider with original video (youtube only) - const newSlidersVolume = document - .querySelector(".ytp-volume-panel") - .getAttribute("aria-valuenow"); - - const videoSlider = document.querySelector("#VOTVideoSlider"); - - if (!videoSlider) { - return; - } - videoSlider.value = newSlidersVolume; - - const videoVolumeLabel = document.querySelector("#VOTVideoVolume"); - - if (videoVolumeLabel) { - videoVolumeLabel.innerText = `${newSlidersVolume}%`; - } - - if (dbSyncVolume === 1) { - tempOriginalVolume = Number(newSlidersVolume); - } - } - - async function getVideoData() { - const videoData = {}; - - videoData.duration = video?.duration || 0; - - videoData.videoId = getVideoId(siteHostname); - - videoData.detectedLanguage = translateFromLang; - - videoData.responseLanguage = translateToLang; - - if (window.location.hostname.includes("youtube.com")) { - ytData = await getYTVideoData(); - ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); - videoData.detectedLanguage = ytData.detectedLanguage; - videoData.responseLanguage = ytData.responseLanguage; - } else if ( - window.location.hostname.includes("rutube") || - window.location.hostname.includes("my.mail.ru") - ) { - videoData.detectedLanguage = "ru"; - videoData.responseLanguage = "en"; - } else if (window.location.hostname.includes("bilibili.com")) { - videoData.detectedLanguage = "zh"; - } - - return videoData; - } - - const lipSync = (mode = false) => { - debug.log("lipsync video", video); - if (!video) { - return; - } - audio.currentTime = video.currentTime; - audio.playbackRate = video.playbackRate; - - if (!mode) { - debug.log("lipsync mode is not set"); - return; - } - - if (mode === "play") { - debug.log("lipsync mode is play"); - const audioPromise = audio.play(); - if (audioPromise !== undefined) { - audioPromise.catch((e) => { - console.error(e); - if (e.name === "NotAllowedError") { - const errorMessage = translations[lang].grantPermissionToAutoPlay; - transformBtn("error", errorMessage); - throw `VOT: ${errorMessage}`; - } else if (e.name === "NotSupportedError") { - const errorMessage = sitesChromiumBlocked.includes( - window.location.hostname - ) - ? translations[lang].neededAdditionalExtension - : translations[lang].audioFormatNotSupported; - transformBtn("error", errorMessage); - throw `VOT: ${errorMessage}`; - } - }); - } - return; - } - if (mode === "pause" || "stop" || "waiting" || "abort") { - debug.log(`lipsync mode is ${mode}`); - audio.pause(); - } - if (mode === "playing") { - debug.log("lipsync mode is playing"); - audio.play(); - } - }; - - function addVideoSlider() { - if ( - dbShowVideoSlider !== 1 || - document.querySelector("#VOTVideoSlider") || - document.querySelector(".translationBtn").dataset.state !== "success" - ) { - return; - } - - const newVolume = - window.location.hostname.includes("youtube.com") && - !dbAutoSetVolumeYandexStyle - ? document - .querySelector(".ytp-volume-panel") - ?.getAttribute("aria-valuenow") - : Math.round(video.volume * 100); - tempOriginalVolume = newVolume; - - const slider = createMenuSlider( - "VOTVideoSlider", - newVolume, - `${translations[lang].VOTVolume}: ${newVolume}%` - ); - - slider.querySelector("#VOTVideoSlider").oninput = (event) => { - const { value } = event.target; - video.volume = value / 100; - slider.querySelector("#VOTOriginalVolume").innerText = `${value}%`; - - if (dbSyncVolume !== 1) { - return; - } - - // Sync translation volume slider with video volume slider - const translateVolumeSlider = document.querySelector( - "#VOTTranslationSlider" - ); - - if (!translateVolumeSlider) { - return; - } - const translateVolume = Number(translateVolumeSlider.value); - const finalValue = syncVolume( - audio, - value, - translateVolume, - tempOriginalVolume - ); - - translateVolumeSlider.value = finalValue; - - const translateVolumeLabel = document.querySelector( - "#VOTTranslationVolume" - ); - - if (translateVolumeLabel) { - translateVolumeLabel.innerText = `${finalValue}%`; - } - - tempVolume = finalValue; - tempOriginalVolume = value; - }; - - const menuOptions = document.querySelector(".translationMenuOptions"); - menuOptions.appendChild(slider); - } - - function addTranslationSlider() { - // Return early if slider already exists or translation is not successful - if ( - document.querySelector("#VOTTranslationSlider") || - document.querySelector(".translationBtn").dataset.state !== "success" - ) { - return; - } - - // Use dbDefaultVolume or 100 as the default translation volume - const defaultTranslateVolume = - typeof dbDefaultVolume === "number" ? dbDefaultVolume : 100; - tempOriginalVolume = defaultTranslateVolume; - - // Create a slider element with the default volume and label - const slider = createMenuSlider( - "VOTTranslationSlider", - defaultTranslateVolume, - `${translations[lang].VOTVolumeTranslation}: ${defaultTranslateVolume}%` - ); - - // Add an input event listener to the slider - slider.querySelector("#VOTTranslationSlider").oninput = async ({ - target: { value }, - }) => { - // Set the audio volume to the slider value - audio.volume = value / 100; - - // Update the volume label - document.querySelector("#VOTTranslationVolume").innerText = `${value}%`; - - // Update the database with the new volume value - await updateDB({ defaultVolume: Number(value) }); - dbDefaultVolume = Number(value); - - // Sync translation volume with video volume if dbSyncVolume is 1 - if (dbSyncVolume === 1) { - syncTranslationWithVideo(value); - } - }; - - // Append the slider to the menu options - const menuOptions = document.querySelector(".translationMenuOptions"); - menuOptions.appendChild(slider); - } - - // A helper function to sync translation volume with video volume - function syncTranslationWithVideo(translationValue) { - // Get the video volume slider element - const videoVolumeSlider = document.querySelector("#VOTVideoSlider"); - - if (!videoVolumeSlider) { - return; - } - // Get the video volume value - const videoVolume = Number(videoVolumeSlider.value); - - // Calculate the synced video volume based on the translation volume - const finalValue = syncVolume( - video, - translationValue, - videoVolume, - tempVolume - ); - - // Set the video volume slider value to the synced value - videoVolumeSlider.value = finalValue; - - // Update the video volume label - const videoVolumeLabel = document.querySelector("#VOTOriginalVolume"); - if (videoVolumeLabel) videoVolumeLabel.innerText = `${finalValue}%`; - - // Update the temp variables for future syncing - tempOriginalVolume = finalValue; - tempVolume = translationValue; - } - - async function videoValidator() { - if (window.location.hostname.includes("youtube.com")) { - ytData = setDetectedLangauge(ytData, ytData.detectedLanguage); - debug.log("VideoValidator videoData: ", videoData); - if (dontTranslateYourLang === 1 && ytData.detectedLanguage === lang) { - firstPlay = false; - throw translations[lang].VOTDisableFromYourLang; - } - - if (ytData.isLive) { - throw translations[lang].VOTLiveNotSupported; - } - - if (ytData.isPremiere) { - throw translations[lang].VOTPremiere; - } - if (videoData.duration > 14_400) { - throw translations[lang].VOTVideoIsTooLong; - } - } - return true; - } - - const translateExecutor = async (VIDEO_ID) => { - debug.log("Run videoValidator"); - await videoValidator(); - debug.log("Run translateFunc"); - await translateFunc( - VIDEO_ID, - videoData.detectedLanguage, - videoData.responseLanguage - ); - }; - - // Define a function to handle common events - function handleVideoEvent(event) { - debug.log(`video ${event.type}`); - lipSync(event.type); - } - - // Define a function to stop translation and clean up - function stopTranslation() { - stopTraslate(); - syncVideoVolumeSlider(); - } - - // Define a function to translate a video and handle the callback - function translateFunc(VIDEO_ID, requestLang, responseLang) { - const videoURL = `${siteTranslates[siteHostname]}${VIDEO_ID}`; - translateVideo( - videoURL, - translateFuncParam, - requestLang, - responseLang, - async (success, urlOrError) => { - debug.log("[exec callback] translateVideo"); - if (getVideoId(siteHostname) !== VIDEO_ID) return; - if (!success) { - transformBtn("error", urlOrError); - // if the error line contains information that the translation is being performed, then we wait - if (urlOrError.includes(translations[lang].translationTake)) { - clearTimeout(autoRetry); - autoRetry = setTimeout( - () => translateFunc(VIDEO_ID, requestLang, responseLang), - 60_000 - ); - } - throw urlOrError; - } - - audio.src = urlOrError; - - // cf version only - if ( - BUILD_MODE === "cloudflare" && - dbAudioProxy === 1 && - urlOrError.startsWith("https://") - ) { - const audioPath = urlOrError.replace( - "https://vtrans.s3-private.mds.yandex.net/tts/prod/", - "" - ); - const proxiedAudioUrl = `https://${workerHost}/video-translation/audio-proxy/${audioPath}`; - console.log(`VOT Audio proxied via ${proxiedAudioUrl}`); - audio.src = proxiedAudioUrl; - } - - volumeOnStart = video?.volume; - if (typeof dbDefaultVolume === "number") { - audio.volume = dbDefaultVolume / 100; - } - if ( - typeof dbAutoSetVolumeYandexStyle === "number" && - dbAutoSetVolumeYandexStyle - ) { - video.volume = autoVolume; - } - - switch (siteHostname) { - case "twitter": - document - .querySelector('div[data-testid="app-bar-back"][role="button"]') - .addEventListener("click", stopTranslation); - break; - case "invidious": - case "piped": - break; - default: - if (siteEvent !== null) { - document.body.addEventListener(siteEvent, stopTranslation); - } - break; - } - - const siteHostnames = [ - "twitch", - "vimeo", - "facebook", - "rutube", - "twitter", - "bilibili.com", - "mail.ru", - ]; - for (let i = 0; i < siteHostnames.length; i++) { - if (siteHostname === siteHostnames[i]) { - const mutationObserver = new MutationObserver( - async (mutations) => { - mutations.forEach(async (mutation) => { - if ( - mutation.type === "attributes" && - mutation.attributeName === "src" && - mutation.target === video && - mutation.target.src !== "" - ) { - stopTranslation(); - firstPlay = true; - } - }); - } - ); - mutationObserver.observe(videoContainer, { - attributes: true, - childList: false, - subtree: true, - attributeOldValue: true, - }); - break; - } - } - - if (video && !video.paused) lipSync("play"); - const videos = document.querySelectorAll("video"); - const events = [ - "playing", - "ratechange", - "play", - "abort", - "waiting", - "pause", - ]; - videos.forEach((v) => - events.forEach((e) => v.addEventListener(e, handleVideoEvent)) - ); - transformBtn("success", translations[lang].disableTranslate); - addVideoSlider(); - addTranslationSlider(); - - const VOTVideoSlider = document.querySelector("#VOTVideoSlider"); - if (VOTVideoSlider) VOTVideoSlider.value = autoVolume * 100; - - const VOTOriginalVolume = - document.querySelector("#VOTOriginalVolume"); - if (VOTOriginalVolume) { - VOTOriginalVolume.innerText = `${autoVolume * 100}%`; - } - - const downloadBtn = document.querySelector(".translationDownload"); - downloadBtn.href = urlOrError; - downloadBtn.style.display = "initial"; - } - ); - } - - document.addEventListener("click", (event) => { - const block = document.querySelector(".translationBlock"); - const menuContainer = document.querySelector(".translationMenuContent"); - const isBlock = - block || event.target === block ? block.contains(event.target) : false; - const isContent = - menuContainer || event.target === menuContainer - ? menuContainer.contains(event.target) - : false; - const isVideo = - videoContainer || event.target === videoContainer - ? videoContainer.contains(event.target) - : false; - - debug.log(`[document click] ${isBlock} ${isContent} ${isVideo}`); - if (!(!isBlock && !isContent)) return; - if (!isVideo) logout(0); - - menuContainer.style.display = "none"; - openedMenu = false; - }); - - const addEventListeners = (element, events, handler) => { - events.forEach((event) => element.addEventListener(event, handler)); - }; - - if (siteHostname === "pornhub") { - if (window.location.pathname.includes("view_video.php")) { - const videoElement = document.querySelector( - ".original.mainPlayerDiv > video-element > div" - ); - addEventListeners(videoElement, ["mousemove", "mouseout"], resetTimer); - } else if (window.location.pathname.includes("embed/")) { - const playerElement = document.querySelector("#player"); - addEventListeners(playerElement, ["mousemove", "mouseout"], resetTimer); - } - } else if (siteHostname === "twitter") { - const videoPlayerElement = document.querySelector( - 'div[data-testid="videoPlayer"' - ); - addEventListeners( - videoPlayerElement, - ["mousemove", "mouseout"], - resetTimer - ); - } else { - addEventListeners(videoContainer, ["mousemove", "mouseout"], resetTimer); - } - - document - .querySelector(".translationBlock") - .addEventListener("mousemove", (event) => - changeOpacityOnEvent(event, timer, opacityRatio) - ); - document - .querySelector(".translationMenuContent") - .addEventListener("mousemove", (event) => - changeOpacityOnEvent(event, timer, opacityRatio) - ); - - document.addEventListener("touchstart", (event) => - changeOpacityOnEvent(event, timer, opacityRatio) - ); - document.addEventListener("touchmove", (event) => - changeOpacityOnEvent(event, timer, opacityRatio) - ); - document.addEventListener("touchend", (event) => - changeOpacityOnEvent(event, timer, opacityRatio) - ); - - document - .querySelector(".translationBtn") - .addEventListener("click", async (event) => { - debug.log("[click translationBtn] before all functions & methods"); - event.stopPropagation(); - event.stopImmediatePropagation(); - - // check if the audio source is not empty - if (audio.src) { - debug.log("[click translationBtn] audio.src is not empty"); - stopTraslate(); - return; - } - - try { - debug.log("[click translationBtn] trying execute translation"); - const VIDEO_ID = getVideoId(siteHostname); - - if (!VIDEO_ID) { - throw translations[lang].VOTNoVideoIDFound; - } - - await translateExecutor(VIDEO_ID); - } catch (err) { - transformBtn("error", String(err).substring(4, err.length)); - console.error(err); - } - }); - - video.addEventListener("progress", async (event) => { - event.stopPropagation(); - - if (!(firstPlay && dbAutoTranslate === 1)) { - return; - } - const VIDEO_ID = getVideoId(siteHostname); - - if (!VIDEO_ID) { - throw translations[lang].VOTNoVideoIDFound; - } - - try { - await translateExecutor(VIDEO_ID); - firstPlay = false; - } catch (err) { - transformBtn("error", String(err).substring(4, err.length)); - firstPlay = false; - } - }); - } - - async function initWebsite() { - debug.log("Runned initWebsite function"); - if (regexes.youtubeRegex.test(window.location.hostname)) { - if (window.location.pathname.includes("embed")) { - const videoContainer = document.querySelector(".html5-video-container"); - await translateProccessor(videoContainer, "youtube", null); - return; - } - - debug.log("[initWebsite] Found a match with youtube hostname"); - const ytPageEnter = () => { - const videoContainer = document.querySelector( - selectors.youtubeSelector - ); - if (videoContainer) { - debug.log("[exec] translateProccessor youtube on page enter"); - translateProccessor(videoContainer, "youtube", "yt-translate-stop"); - } else { - if (!ytplayer || !ytplayer.config) { - debug.log("[exec] ytplayer is null"); - return; - } - ytplayer.config.args.jsapicallback = () => { - debug.log( - "[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)" - ); - translateProccessor(videoContainer, "youtube", "yt-translate-stop"); - }; - } - }; - - document.addEventListener("spfdone", ytPageEnter); - document.addEventListener("yt-navigate-finish", ytPageEnter); - - const ytPageLeave = () => { - document.body.dispatchEvent(new Event("yt-translate-stop")); - }; - - document.addEventListener("spfrequest", ytPageLeave); - document.addEventListener("yt-navigate-start", ytPageLeave); - - if (window.location.hostname.includes("m.youtube.com")) { - let ytmobile = await waitForElm("#player"); - if (ytmobile) { - await sleep(1000); - await translateProccessor(ytmobile, "youtube", "yt-translate-stop"); - - const mutationObserver = new MutationObserver(async (mutations) => { - for (const mutation of mutations) { - if ( - mutation.type === "attributes" && - mutation.attributeName === "src" - ) { - ytmobile = await waitForElm("#player"); - await sleep(1000); - await translateProccessor( - ytmobile, - "youtube", - "yt-translate-stop" - ); - } - } - }); - - mutationObserver.observe(ytmobile, { - attributes: true, - childList: true, - subtree: true, - attributeOldValue: true, - }); - } - const ytPageLeave = () => { - document.body.dispatchEvent(new Event("yt-translate-stop")); - }; - document.addEventListener("spfdone", ytPageLeave); - document.addEventListener("yt-navigate-finish", ytPageLeave); - document.addEventListener("spfrequest", ytPageLeave); - document.addEventListener("yt-navigate-start", ytPageLeave); - } - return; - } - if (window.location.hostname.includes("twitch.tv")) { - debug.log("[initWebsite] Found a match with twitch.tv"); - if ( - window.location.hostname.includes("m.twitch.tv") && - (window.location.pathname.includes("/videos/") || - window.location.pathname.includes("/clip/")) - ) { - debug.log("[initWebsite] Matched Twitch Mobile"); - const el = await waitForElm(selectors.twitchMobileSelector); - if (el) { - await sleep(200); - const twitchMobileSelector = document.querySelector( - selectors.twitchMobileSelector - ); - await translateProccessor(twitchMobileSelector, "twitch", null); - - const mutationObserver = new MutationObserver(async (mutations) => { - for (const mutation of mutations) { - if ( - mutation.type === "attributes" && - mutation.attributeName === "src" && - mutation.target === twitchMobileSelector?.querySelector("video") - ) { - await sleep(1000); - await translateProccessor(twitchMobileSelector, "twitch", null); - } - } - }); - - mutationObserver.observe(twitchMobileSelector, { - attributes: true, - childList: true, - subtree: true, - attributeOldValue: true, - }); - } - } else if ( - window.location.hostname.includes("player.twitch.tv") || - window.location.hostname.includes("clips.twitch.tv") || - window.location.pathname.includes("/videos/") || - window.location.pathname.includes("/clip/") - ) { - debug.log("[initWebsite] Matched Twitch Desktop"); - const el = await waitForElm(selectors.twitchSelector); - if (el) { - await sleep(200); - await translateProccessor(el, "twitch", null); - } - } - debug.log("[initWebsite] Exit function in the twitch section"); - return; - } - if (window.location.hostname.includes("xvideos.com")) { - debug.log("[entered] xvideos"); - await sleep(1000); - await translateProccessor( - document.querySelector(".video-bg-pic"), - "xvideos", - null - ); - return; - } - if (window.location.hostname.includes("pornhub.com")) { - debug.log("[entered] pornhub"); - await sleep(1000); - await translateProccessor( - document.querySelector(".mgp_videoWrapper"), - "pornhub", - null - ); - return; - } - if (sitesInvidious.includes(window.location.hostname)) { - // Need an additional extension to work in chrome-like browsers - debug.log("[entered] invidious"); - await translateProccessor( - document.querySelector("#player"), - "youtube", - null - ); - } else if (sitesPiped.includes(window.location.hostname)) { - // Need an additional extension to work in chrome-like browsers - debug.log("[entered] piped"); - const el = await waitForElm(selectors.pipedSelector); - if (el) { - let videoIDNew; - let videoID = getVideoId("youtube"); - await translateProccessor(el, "youtube", "piped"); - setInterval(async () => { - videoIDNew = getVideoId("youtube"); - if (videoID !== videoIDNew) { - if (videoIDNew) { - await translateProccessor( - document.querySelector(selectors.pipedSelector), - "youtube", - "piped" - ); - } - videoID = videoIDNew; - } - }, 3000); - } - } else if (/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)) { - debug.log("[entered] vk.com"); - const el = await waitForElm(selectors.vkSelector); - if (el) { - await translateProccessor( - document.querySelector(selectors.vkSelector), - "vk", - null - ); - let videoIDVKNew; - let videoIDVK = getVideoId("vk"); - setInterval(async () => { - videoIDVKNew = getVideoId("vk"); - if (videoIDVK !== videoIDVKNew) { - if (videoIDVKNew) { - const el = await waitForElm(selectors.vkSelector); - if (el) { - await translateProccessor(el, "vk", null); - } - } - videoIDVK = videoIDVKNew; - } - }, 3000); - } - } else if (window.location.hostname.includes("vimeo.com")) { - debug.log("[entered] vimeo.com"); - const el = await waitForElm(selectors.vimeoSelector); - if (el) { - await sleep(1000); - await translateProccessor( - document.querySelector(selectors.vimeoSelector), - "vimeo", - null - ); - } - } else if (window.location.hostname.includes("9gag.com")) { - await sleep(1000); - await translateProccessor( - document.querySelector(selectors.gagSelector), - "9gag", - null - ); - } else if (window.location.hostname.includes("coub.com")) { - await sleep(1000); - await translateProccessor( - document.querySelector(".viewer__player"), - "coub", - null - ); - } else if (window.location.hostname.includes("rutube.ru")) { - const elementSelector = window.location.pathname.includes("/play/embed") - ? "#app > div > div" - : ".video-player > div > div > div:nth-child(2)"; - - const el = await waitForElm(elementSelector); - if (el) { - await translateProccessor(el, "rutube", null); - } - } else if (window.location.hostname.includes("bilibili.com")) { - if (window.location.pathname.includes("/video/")) { - const el = await waitForElm(selectors.bilibilicomSelector); - if (el) { - await translateProccessor(el, "bilibili.com", null); - } - } else if ( - window.location.pathname.includes( - "/blackboard/webplayer/embed-old.html" - ) - ) { - const el = await waitForElm("video"); - if (el) { - await translateProccessor(el.parentElement, "bilibili.com", null); - } - } - } else if (window.location.hostname.includes("twitter.com")) { - const el = await waitForElm(selectors.twitterSelector); - if (el) { - let videoIDNew; - let videoID = getVideoId("twitter"); - await translateProccessor(el, "twitter", null); - setInterval(async () => { - videoIDNew = getVideoId("twitter"); - if (videoID !== videoIDNew) { - if (videoIDNew) { - await translateProccessor( - document.querySelector(selectors.twitterSelector), - "twitter", - null - ); - } - videoID = videoIDNew; - } - }, 3000); - } - } else if (window.location.hostname.includes("my.mail.ru")) { - const el = await waitForElm(selectors.mailSelector); - if (el) { - let videoIDNew; - let videoID = getVideoId("mail.ru"); - await translateProccessor(el, "mail.ru", null); - setInterval(async () => { - videoIDNew = getVideoId("mail.ru"); - if (videoID !== videoIDNew) { - if (videoIDNew) { - await translateProccessor( - document.querySelector(selectors.mailSelector), - "mail.ru", - null - ); - } - videoID = videoIDNew; - } - }, 3000); - } - } - } - - await initWebsite(); -} - -main().catch((e) => { - console.error(e); -}); diff --git a/src/src/indexedDB.js b/src/src/indexedDB.js deleted file mode 100644 index 778e7ea3..00000000 --- a/src/src/indexedDB.js +++ /dev/null @@ -1,349 +0,0 @@ -import { lang } from "./menu.js"; -import { translations } from "./config/constants.js"; - -// --- IndexedDB functions start: -const dbVersion = 2; // current db version -const settingsDefault = { - key: "settings", - autoTranslate: 0, - defaultVolume: 100, - showVideoSlider: 0, - syncVolume: 0, - autoSetVolumeYandexStyle: 1, - dontTranslateYourLang: 1, -}; // default settings for db v1 - -const valuesV2 = { - audioProxy: 0, -}; - -function openDB(name) { - return indexedDB.open(name, dbVersion); -} - -async function initDB() { - return new Promise((resolve, reject) => { - function updateVersionProccessor( - transaction, - db, - indexes, - previousIndexes = {} - ) { - // openRequest is transaction object - // indexes is object of strings with default values (used for createIndex) ex. {"name": 0} - // previousIndexes is indexes for previous version - const objectStore = transaction.objectStore("settings"); - - for (const key of Object.keys(indexes)) { - objectStore.createIndex(key, key, { unique: false }); - } - - console.log("VOT: The database has been updated"); - objectStore.transaction.oncomplete = (event) => { - const objectStore = db - .transaction("settings", "readwrite") - .objectStore("settings"); - const request = objectStore.get("settings"); - - request.onerror = (event) => { - console.error( - "VOT: Data could not be retrieved from the Database: ", - event.error - ); - reject(false); - }; - - request.onsuccess = () => { - const data = - request.result || Object.assign(settingsDefault, previousIndexes); // use data from db or reset all data - for (const key in indexes) { - data[key] = indexes[key]; - } - - const requestUpdate = objectStore.put(data); - - requestUpdate.onerror = (event) => { - console.error( - "VOT: Failed to update the Database to new version", - event.error - ); - reject(false); - }; - - requestUpdate.onsuccess = () => { - console.log( - "VOT: Standard settings of the new version have been added to the Database." - ); - resolve(true); - }; - }; - }; - } - - const openRequest = openDB("VOT"); - - openRequest.onerror = () => { - console.error( - `${translations[lang].VOTFailedInitDB}: ${openRequest.error.message}` - ); - reject(false); - }; - - openRequest.onupgradeneeded = (event) => { - const db = openRequest.result; - - db.onerror = () => { - const errorMessage = translations[lang].VOTFailedInitDB; - alert(errorMessage); - console.error(errorMessage, openRequest.error); - reject(false); - }; - - if (event.oldVersion < 1) { - // db not found - const objectStore = db.createObjectStore("settings", { - keyPath: "key", - }); - - // add indexes for 1 version (without key index) - for (const key of Object.keys(settingsDefault).filter( - (k) => k !== "key" - )) { - objectStore.createIndex(key, key, { unique: false }); - } - - console.log("VOT: Database Created"); - - objectStore.transaction.oncomplete = (event) => { - const objectStore = db - .transaction("settings", "readwrite") - .objectStore("settings"); - const request = objectStore.add(settingsDefault); - - request.onsuccess = () => { - console.log( - "VOT: Standard settings added to the Database: ", - request.result - ); - resolve(true); - }; - - request.onerror = () => { - console.log( - "VOT: Error when adding standard settings to the Database: ", - request.error - ); - reject(false); - }; - }; - } - - if (event.oldVersion < 2) { - // db is outdated (db version is 1) - updateVersionProccessor(openRequest.transaction, db, valuesV2); - } - }; - - openRequest.onsuccess = () => { - const db = openRequest.result; - db.onversionchange = () => { - db.close(); - const errorMessage = translations[lang].VOTDBNeedUpdate; - alert(errorMessage); - console.log(errorMessage); - window.location.reload(); - reject(false); - }; - resolve(true); - }; - - openRequest.onblocked = () => { - const db = openRequest.result; - const errorMessage = translations[lang].VOTDisabledForDBUpdating; - console.error(errorMessage, db); - alert(errorMessage); - reject(false); - }; - }); -} - -async function updateDB({ - autoTranslate, - defaultVolume, - showVideoSlider, - syncVolume, - autoSetVolumeYandexStyle, - dontTranslateYourLang, - audioProxy, -}) { - return new Promise((resolve, reject) => { - if ( - typeof autoTranslate === "number" || - typeof defaultVolume === "number" || - typeof showVideoSlider === "number" || - typeof syncVolume === "number" || - typeof autoSetVolumeYandexStyle === "number" || - typeof dontTranslateYourLang === "number" || - typeof audioProxy === "number" - ) { - const openRequest = openDB("VOT"); - - openRequest.onerror = () => { - const errorMessage = translations[lang].VOTFailedWriteToDB; - alert(errorMessage); - console.error(errorMessage, openRequest.error.message); - reject(false); - }; - - openRequest.onupgradeneeded = async () => { - const db = openRequest.result; - db.close(); - await initDB(); - resolve(true); - }; - - openRequest.onsuccess = () => { - const db = openRequest.result; - db.onversionchange = () => { - db.close(); - console.log( - "VOT: The database needs an update, please reload the page if it didn't happen automatically" - ); - window.location.reload(); - reject(false); - }; - - const objectStore = db - .transaction("settings", "readwrite") - .objectStore("settings"); - const request = objectStore.get("settings"); - - request.onerror = (event) => { - console.error( - "VOT: Data could not be retrieved from the Database: ", - event.error - ); - reject(false); - }; - - request.onsuccess = () => { - const data = request.result; - - if (typeof autoTranslate === "number") { - data.autoTranslate = autoTranslate; - } - - if (typeof defaultVolume === "number") { - data.defaultVolume = defaultVolume; - } - - if (typeof showVideoSlider === "number") { - data.showVideoSlider = showVideoSlider; - } - - if (typeof syncVolume === "number") { - data.syncVolume = syncVolume; - } - - if (typeof autoSetVolumeYandexStyle === "number") { - data.autoSetVolumeYandexStyle = autoSetVolumeYandexStyle; - } - - if (typeof dontTranslateYourLang === "number") { - data.dontTranslateYourLang = dontTranslateYourLang; - } - - if (typeof audioProxy === "number") { - data.audioProxy = audioProxy; - } - - const requestUpdate = objectStore.put(data); - - requestUpdate.onerror = (event) => { - console.error( - "VOT: Не удалось обновить данные в Базе Данных: ", - event.error - ); - reject(false); - }; - - requestUpdate.onsuccess = () => { - resolve(true); - }; - }; - }; - - openRequest.onblocked = () => { - const db = openRequest.result; - const errorMessage = translations[lang].VOTDisabledForDBUpdating; - console.error(errorMessage, db); - alert(errorMessage); - reject(false); - }; - } - }); -} - -async function readDB() { - return new Promise((resolve, reject) => { - const openRequest = openDB("VOT"); - - openRequest.onerror = () => { - const errorMessage = translations[lang].VOTFailedReadFromDB; - alert(errorMessage); - console.error(errorMessage, openRequest.error.message); - reject(false); - }; - - openRequest.onupgradeneeded = async () => { - const db = openRequest.result; - db.close(); - await initDB(); - resolve(true); - }; - - openRequest.onsuccess = () => { - const db = openRequest.result; - db.onversionchange = () => { - db.close(); - const errorMessage = translations[lang].VOTDBNeedUpdate; - alert(errorMessage); - console.error(errorMessage); - reject(false); - }; - - const objectStore = db.transaction("settings").objectStore("settings"); - const request = objectStore.get("settings"); - - request.onerror = (event) => { - console.error(translations[lang].VOTFailedReadFromDB, event.error); - console.error(event); - reject(false); - }; - - request.onsuccess = () => { - if (request.result === undefined) { - db.close(); - deleteDB(); - reject(false); - } - const data = request.result; - resolve(data); - }; - }; - - openRequest.onblocked = () => { - const db = openRequest.result; - const errorMessage = translations[lang].VOTDisabledForDBUpdating; - console.error(errorMessage, db); - alert(errorMessage); - reject(false); - }; - }); -} - -function deleteDB() { - indexedDB.deleteDatabase("VOT"); -} - -export { initDB, readDB, updateDB, deleteDB }; diff --git a/src/src/locales/de/headers.json b/src/src/locales/de/headers.json deleted file mode 100644 index 2e24e847..00000000 --- a/src/src/locales/de/headers.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "[VOT] - Voice-Over-Video-Übersetzung", - "description": "Eine kleine Erweiterung, die eine Voice-over-Übersetzung von Videos aus dem Yandex-Browser zu anderen Browsern hinzufügt" -} diff --git a/src/src/locales/es/headers.json b/src/src/locales/es/headers.json deleted file mode 100644 index 202471cd..00000000 --- a/src/src/locales/es/headers.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "[VOT] - Traducción de vídeo en off", - "description": "Una pequeña extensión que agrega una traducción de voz en off de un video de Yandex Browser a otros navegadores" -} diff --git a/src/src/locales/fr/headers.json b/src/src/locales/fr/headers.json deleted file mode 100644 index b19edec3..00000000 --- a/src/src/locales/fr/headers.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "[VOT] - Traduction vidéo voix-off", - "description": "Une petite extension qui ajoute la traduction vocale de la vidéo du Navigateur Yandex à d'autres navigateurs" -} diff --git a/src/src/locales/it/headers.json b/src/src/locales/it/headers.json deleted file mode 100644 index 2eee6b43..00000000 --- a/src/src/locales/it/headers.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "[VOT] - Traduzione Video fuori campo", - "description": "Una piccola estensione che aggiunge la traduzione vocale del video dal browser Yandex ad altri browser" -} diff --git a/src/src/locales/ru/headers.json b/src/src/locales/ru/headers.json deleted file mode 100644 index 7fdc1c8e..00000000 --- a/src/src/locales/ru/headers.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "[VOT] - Закадровый перевод видео", - "description": "Небольшое расширение, которое добавляет закадровый перевод видео из Яндекс Браузера в другие браузеры" -} diff --git a/src/src/locales/zh/headers.json b/src/src/locales/zh/headers.json deleted file mode 100644 index d02dad6b..00000000 --- a/src/src/locales/zh/headers.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "[VOT] - 画外音视频翻译", - "description": "一个小扩展,它增加了视频从Yandex浏览器到其他浏览器的画外音翻译" -} diff --git a/src/src/menu.js b/src/src/menu.js deleted file mode 100644 index 464d2871..00000000 --- a/src/src/menu.js +++ /dev/null @@ -1,196 +0,0 @@ -import debug from "./utils/debug.js"; -import { translations } from "./config/constants.js"; - -const userlang = navigator.language || navigator.userLanguage; -let lang = userlang.substr(0, 2).toLowerCase(); -if (!(lang in translations)) { - lang = "en"; -} - -function changeBtnColor(n) { - document.querySelector(".translationBtn").style.color = n; -} - -function changeBtnState(newState = "none") { - document.querySelector(".translationBtn").dataset.state = newState; -} - -function changeIconBackground(type = "none") { - let iconBackgroundColor; - switch (type) { - case "error": - iconBackgroundColor = "#7A7A7D"; - break; - case "success": - iconBackgroundColor = "#A36EFF"; - break; - default: - iconBackgroundColor = "#FFFFFF"; - break; - } - - document.querySelector(".translateIcon").style.fill = iconBackgroundColor; -} - -function transformBtn(type = "none", text) { - switch (type) { - case "error": - changeIconBackground(type); - changeBtnColor("#7A7A7D"); - changeBtnState(type); - break; - case "success": - changeIconBackground(type); - changeBtnColor("#A36EFF"); - changeBtnState(type); - break; - default: - changeIconBackground("none"); - changeBtnColor("#FFFFFF"); - changeBtnState("none"); - break; - } - - document.querySelector(".translationBtn").innerText = text; -} - -// Add translation buttton block -function addTranslationBlock(element) { - if (!element || element.querySelector(".translationBlock")) return; - - const block = document.createElement("div"); - block.classList.add("translationBlock"); - block.innerHTML = ` - - - - - - - ${translations[lang].translateVideo} - - - - - - - `; - - element.appendChild(block); - debug.log("VOT: Added translation button to ", element); -} - -function createTranslationMenu() { - const container = document.createElement("div"); - container.classList.add("translationMenuContent"); - container.innerHTML = ` -

${translations[lang].translationSettings}

-
-
- - - - - - -
- `; - - container.onclick = (event) => event.stopPropagation(); - return container; -} - -// Create checkbox for menu -function createMenuCheckbox(id, valueToCheck, content) { - const checkboxContainer = document.createElement("div"); - const checkbox = document.createElement("input"); - const checkboxLabel = document.createElement("label"); - - checkbox.type = "checkbox"; - checkbox.id = id; - checkbox.checked = Boolean(valueToCheck); - - checkboxLabel.htmlFor = id; - checkboxLabel.innerHTML = content; - - checkboxContainer.classList.add("translationMenuContainer"); - checkboxContainer.appendChild(checkbox); - checkboxContainer.appendChild(checkboxLabel); - - return checkboxContainer; -} - -// Create slider for menu -function createMenuSlider(id, sliderValue, content) { - const sliderContainer = document.createElement("div"); - const slider = document.createElement("input"); - const sliderLabel = document.createElement("label"); - - slider.type = "range"; - slider.id = id; - slider.classList.add("VOTMenuSlider"); - slider.min = 0; - slider.max = 100; - slider.value = sliderValue; - - sliderLabel.htmlFor = id; - sliderLabel.classList.add("translationHeader"); - sliderLabel.innerHTML = content; - - sliderContainer.classList.add("translationMenuContainer"); - sliderContainer.appendChild(sliderLabel); - sliderContainer.appendChild(slider); - - return sliderContainer; -} - -// Create select for menu -function createMenuSelect(id, selectOptions) { - // selectOptions structure: - // [ - // { - // label: string, - // value: string, - // selected: boolean, - // disabled: boolean - // } - // ] - const selectContainer = document.createElement("div"); - const select = document.createElement("select"); - - select.id = id; - select.classList.add("VOTMenuSelect"); - - for (const option of selectOptions) { - const optionElement = document.createElement("option"); - optionElement.innerText = option.label; - optionElement.value = option.value; - if ( - Object.prototype.hasOwnProperty.call(option, "selected") && - option.selected - ) { - optionElement.setAttribute("selected", "selected"); - } - - if (Object.prototype.hasOwnProperty.call(option, "disabled")) { - optionElement.disabled = option.disabled; - } - - select.appendChild(optionElement); - } - - selectContainer.classList.add("translationMenuContainer"); - selectContainer.appendChild(select); - - return selectContainer; -} - -export { - transformBtn, - addTranslationBlock, - createTranslationMenu, - createMenuCheckbox, - createMenuSlider, - createMenuSelect, - lang, -}; diff --git a/src/src/rvt-cloudflare.js b/src/src/rvt-cloudflare.js deleted file mode 100644 index 1e444cce..00000000 --- a/src/src/rvt-cloudflare.js +++ /dev/null @@ -1,87 +0,0 @@ -import { getUUID } from "./getUUID.js"; -import { yandexRequests } from "./yandexRequests.js"; -import { workerHost, yandexHmacKey } from "./config/config-cloudflare.js"; -import { yandexUserAgent } from "./config/config.js"; -import debug from "./utils/debug.js"; - -// Request video translation from Yandex API -async function requestVideoTranslation( - url, - unknown1, - requestLang, - responseLang, - callback -) { - // Initialize variables - let response; - let responseBody; - const deviceId = getUUID(true); - const body = yandexRequests.encodeRequest( - url, - deviceId, - unknown1, - requestLang, - responseLang - ); - - try { - debug.log("requestVideoTranslation"); - // Create a key from the HMAC secret - const utf8Encoder = new TextEncoder("utf-8"); - const key = await window.crypto.subtle.importKey( - "raw", - utf8Encoder.encode(yandexHmacKey), - { name: "HMAC", hash: { name: "SHA-256" } }, - false, - ["sign", "verify"] - ); - // Sign the body with the key - const signature = await window.crypto.subtle.sign("HMAC", key, body); - // Convert the signature to a hex string - const hexSignature = Array.from(new Uint8Array(signature), (x) => - x.toString(16).padStart(2, "0") - ).join(""); - // Create a fetch options object with headers and body - const options = { - method: "POST", - mode: "cors", - cache: "no-cache", - headers: { - "Content-Type": "application/json", - }, - redirect: "follow", - referrerPolicy: "no-referrer", - body: JSON.stringify({ - headers: { - Accept: "application/x-protobuf", - "Accept-Language": "en", - "Content-Type": "application/x-protobuf", - "User-Agent": yandexUserAgent, - Pragma: "no-cache", - "Cache-Control": "no-cache", - "Sec-Fetch-Mode": "no-cors", - "Vtrans-Signature": hexSignature, - "Sec-Vtrans-Token": getUUID(false), - }, - body: String.fromCharCode(...body), - }), - }; - // Fetch the translation from the worker host - response = await fetch( - `https://${workerHost}/video-translation/translate`, - options - ); - // Get the response body as an array buffer - responseBody = await response.arrayBuffer(); - } catch (exception) { - debug.log(exception); - // Handle errors - response = { status: -1 }; - responseBody = exception; - } - - // Call the callback function with the result - callback(response.status == 200, responseBody); -} - -export default requestVideoTranslation; diff --git a/src/src/rvt.js b/src/src/rvt.js deleted file mode 100644 index 8c2d99dd..00000000 --- a/src/src/rvt.js +++ /dev/null @@ -1,78 +0,0 @@ -import { getUUID } from "./getUUID.js"; -import { yandexRequests } from "./yandexRequests.js"; -import { workerHost, yandexHmacKey, yandexUserAgent } from "./config/config.js"; - -// Request video translation from Yandex API -async function requestVideoTranslation( - url, - unknown1, - requestLang, - responseLang, - callback -) { - // Initialize variables - const deviceId = getUUID(true); - const body = yandexRequests.encodeRequest( - url, - deviceId, - unknown1, - requestLang, - responseLang - ); - - try { - // Create a key from the HMAC secret - const utf8Encoder = new TextEncoder("utf-8"); - const key = await window.crypto.subtle.importKey( - "raw", - utf8Encoder.encode(yandexHmacKey), - { name: "HMAC", hash: { name: "SHA-256" } }, - false, - ["sign", "verify"] - ); - // Sign the body with the key - const signature = await window.crypto.subtle.sign("HMAC", key, body); - // Convert the signature to a hex string - const hexSignature = Array.from(new Uint8Array(signature), (x) => - x.toString(16).padStart(2, "0") - ).join(""); - // Create a fetch options object with headers and body - const options = { - // url: `https://${workerHost}/stream-translation/whitelist-stream`, - // url: `https://${workerHost}/stream-translation/translate-stream`, - url: `https://${workerHost}/video-translation/translate`, - method: "POST", - headers: { - Accept: "application/x-protobuf", - "Accept-Language": "en", - "Content-Type": "application/x-protobuf", - "User-Agent": yandexUserAgent, - Pragma: "no-cache", - "Cache-Control": "no-cache", - "Sec-Fetch-Mode": "no-cors", - "sec-ch-ua": null, - "sec-ch-ua-mobile": null, - "sec-ch-ua-platform": null, - "Vtrans-Signature": hexSignature, - "Sec-Vtrans-Token": getUUID(false), - }, - data: String.fromCharCode(...body), - responseType: "arraybuffer", - }; - // Send the request using GM_xmlhttpRequest - GM_xmlhttpRequest({ - ...options, - onload: (http) => { - callback(http.status === 200, http.response); - }, - onerror: (error) => { - callback(false); - }, - }); - } catch (exception) { - // Handle errors - callback(false); - } -} - -export default requestVideoTranslation; diff --git a/src/src/styles/main.css b/src/src/styles/main.css deleted file mode 100644 index 189531e6..00000000 --- a/src/src/styles/main.css +++ /dev/null @@ -1,247 +0,0 @@ -.translationBlock { - padding: 0.45rem !important; - width: max-content; - position: absolute; - background: #2e2f34; - border-radius: 0.5rem !important; - left: 50%; - top: 5rem; - transform: translate(-50%); - text-align: center; - opacity: 0; - transition: opacity 1s; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - z-index: 100; -} - -.translationBtn { - position: relative; - display: inline-block; - vertical-align: middle; - color: #fff; - padding-right: 0.25rem !important; - cursor: pointer; - font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif; -} - -.translationBlock:hover { - opacity: 1; -} - -.translationMenu { - display: inline-block; - vertical-align: middle; - border-left: 1px solid #424348; - max-height: 16px; - max-width: 24px; - cursor: pointer; -} - -.translationMenuIcon { - padding: 0 10px !important; - width: 24px; -} - -.translationIAlice { - display: inline-block; - vertical-align: middle; - max-height: 26px; - max-width: 50px; -} - -.translationIconAlice { - height: 24px !important; - width: 24px !important; -} - -.translationITranslate { - display: inline-block; - vertical-align: middle; - max-height: 20px; - max-width: 20px; -} - -.translationMenuContent { - position: absolute; - background: #2e2f34; - color: #fff; - display: none; - border-radius: 1rem !important; - left: 50%; - top: 10rem; - transform: translate(-50%); - text-align: left; - font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important; - - width: 300px; - /* height: 375px; */ - opacity: 0; - z-index: 100; - transition: opacity 0.5s ease; -} - -.VOTMenuSlider { - -webkit-appearance: none !important; - appearance: none !important; - width: 268px !important; - height: 8px !important; - outline: none !important; - margin-top: 0.5rem; - opacity: 0.7; - /* background: #3C3F4D !important; */ - background: rgb(253, 222, 85, 0.6) !important; - border: none !important; - border-radius: 2rem !important; - -webkit-transition: 0.2s !important; - transition: opacity 0.2s ease !important; -} - -.VOTMenuSlider:hover { - opacity: 1; -} - -.VOTMenuSlider::-webkit-slider-thumb { - -webkit-appearance: none !important; - appearance: none !important; - width: 10px !important; - height: 10px !important; - border-radius: 50% !important; - border: none !important; - background: #fff !important; - cursor: pointer !important; -} - -.VOTMenuSlider::-moz-range-thumb { - width: 10px !important; - height: 10px !important; - border-radius: 50% !important; - border: none !important; - background: #fff !important; - cursor: pointer !important; -} - -.VOTMenuSlider::-ms-thumb { - width: 10px !important; - height: 10px !important; - border-radius: 50% !important; - border: none !important; - background: #fff !important; - cursor: pointer !important; -} - -.VOTMenuSlider::-ms-fill-lower { - height: 8px !important; - border-radius: 2rem !important; - background: linear-gradient( - 90.1deg, - rgba(186, 153, 244, 0.85) -5.78%, - rgba(236, 138, 202, 0.7) 56.46%, - rgba(239, 168, 117, 0.6) 108.93% - ) !important; -} - -.VOTMenuSlider::-moz-range-progress { - height: 8px !important; - border-radius: 2rem !important; - background: linear-gradient( - 90.1deg, - rgba(186, 153, 244, 0.85) -5.78%, - rgba(236, 138, 202, 0.7) 56.46%, - rgba(239, 168, 117, 0.6) 108.93% - ) !important; -} - -.translationHeader { - padding-bottom: 0.5rem !important; -} - -.translationMainHeader { - margin: 16px !important; - color: #fff; - font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important; -} - -.translationMenuOptions { - display: flex; - flex-flow: column wrap; -} - -.translationMenuContainer { - /* width: 100%; */ - padding-left: 16px !important; - padding-top: 5px !important; - display: inline-block !important; -} - -.translationMenuContainer > input { - appearance: auto !important; - vertical-align: text-bottom; -} - -.translationMenuText { - color: #fff; - display: inline-flex; - width: 80%; -} - -.translationVolumeBox, -.translationVideoVolumeBox { - padding-top: 0.5rem !important; -} - -.translationDropDB { - border: none !important; - border-radius: 4px !important; - background: #5426ff !important; - color: #fff !important; - padding: 6px 16px !important; - margin-left: auto !important; - cursor: pointer !important; -} - -.translationDownload { - background: #5426ff !important; - color: #fff !important; - padding: 2px 10px !important; - border-radius: 4px !important; - cursor: pointer; - display: none; -} - -.translationMenuFunctional { - display: flex; - margin: 16px !important; -} - -.VOTMenuSelect { - width: 110px; - border-radius: 5px !important; - border: 1px solid #dadce0 !important; - box-shadow: 0 1px 3px -2px #9098a9; - box-sizing: border-box !important; - color: #2e2f34 !important; - background: #fff !important; - padding: 5px !important; -} - -.VOTMenuSelect:focus { - outline: none; -} - -.VOTMenuSelect:focus { - outline: none; - border-color: #0077ff; - box-shadow: 0 0 0 2px rgba(#0077ff, 0.2); -} - -#VOTSelectLanguages { - display: flex !important; - margin-left: 5px; -} - -#VOTSelectLanguages svg { - margin: 0 5px; -} diff --git a/src/src/utils/debug.js b/src/src/utils/debug.js deleted file mode 100644 index 855eeee3..00000000 --- a/src/src/utils/debug.js +++ /dev/null @@ -1,33 +0,0 @@ -import { translations } from "../config/constants.js"; - -const debug = {}; -debug.log = (...text) => { - if (!DEBUG_MODE) { - return; - } - return console.log( - "%c[VOT DEBUG]", - "background: #F2452D; color: #fff; padding: 5px;", - ...text - ); -}; - -debug.translations = (testLang) => { - if (!DEBUG_MODE) { - return; - } - // for add indexes - const testedTranslations = Object.entries(translations[testLang]).map( - ([key, value]) => ({ - phrase: key, - translated: value, - }) - ); - testedTranslations.unshift({ - phrase: "language_code (debug only)", - translated: testLang, - }); - return console.table(testedTranslations); -}; - -export default debug; diff --git a/src/src/utils/getYTVideoData.js b/src/src/utils/getYTVideoData.js deleted file mode 100644 index e41d4009..00000000 --- a/src/src/utils/getYTVideoData.js +++ /dev/null @@ -1,66 +0,0 @@ -async function detect(cleanText) { - const response = await fetch("https://rust-server-531j.onrender.com/detect", { - method: "POST", - body: cleanText, - }); - return await response.text(); -} - -// Get the language code from the response or the text -async function getLanguage(player, response, title, description, author) { - if (!window.location.hostname.includes("m.youtube.com")) { - // ! Experimental ! get lang from selected audio track if availabled - const audioTracks = player.getAudioTrack(); - const trackInfo = audioTracks?.getLanguageInfo(); // get selected track info (id === "und" if tracks are not available) - if (trackInfo?.id !== "und") { - return trackInfo.id.split(".")[0]; - } - } - - // TODO: If the audio tracks will work fine, transfer the receipt of captions to the audioTracks variable - // Check if there is an automatic caption track in the response - const captionTracks = - response?.captions?.playerCaptionsTracklistRenderer?.captionTracks; - if (captionTracks?.length) { - const autoCaption = captionTracks.find((caption) => caption.kind === "asr"); - if (autoCaption) { - return autoCaption.languageCode; - } - } - // If there is no caption track, use detect to get the language code from the text - const text = [title, description, author].join(" "); - // Remove anything that is not a letter or a space in any language - const cleanText = text - .replace(/https?:\/\/\S+/g, "") - .replace(/[^\p{L}\s]/gu, "") - .trim() - .slice(0, 250); - return await detect(cleanText); -} - -// Get the video data from the player -async function getYTVideoData() { - const player = document.querySelector("#movie_player"); - const data = player.getVideoData(); - const response = player.getPlayerResponse(); - const { isLive, isPremiere, title, author } = data; - const { shortDescription: description } = response?.videoDetails ?? {}; - const videoData = { - isLive, - isPremiere, - title, - description, - author, - detectedLanguage: await getLanguage( - player, - response, - title, - description, - author - ), - }; - console.log("VOT Detected language: ", videoData.detectedLanguage); - return videoData; -} - -export { getYTVideoData }; diff --git a/src/src/utils/regex.js b/src/src/utils/regex.js deleted file mode 100644 index 352a9ad2..00000000 --- a/src/src/utils/regex.js +++ /dev/null @@ -1,11 +0,0 @@ -const cyrillicRegex = /[а-яА-ЯёЁ]/; - -function checkCyrillic(string) { - return cyrillicRegex.test(string); -} - -function getCyrillicCount(string) { - return string.match(cyrillicRegex).length; -} - -export { checkCyrillic, getCyrillicCount }; diff --git a/src/src/utils/utils.js b/src/src/utils/utils.js deleted file mode 100644 index 8a0d7d6f..00000000 --- a/src/src/utils/utils.js +++ /dev/null @@ -1,168 +0,0 @@ -import { translations } from "../config/constants.js"; -import { lang } from "../menu.js"; - -if (!String.prototype.format) { - // https://stackoverflow.com/questions/610406/javascript-equivalent-to-printf-string-format - // syntax example: "is {0} function".format("format") - String.prototype.format = function () { - // store arguments in an array - var args = arguments; - // use replace to iterate over the string - // select the match and check if the related argument is present - // if yes, replace the match with the argument - return this.replace(/{(\d+)}/g, function (match, index) { - // check if the argument is present - return typeof args[index] != "undefined" ? args[index] : match; - }); - }; -} - -function waitForElm(selector) { - // https://stackoverflow.com/questions/5525071/how-to-wait-until-an-element-exists - return new Promise((resolve) => { - const element = document.querySelector(selector); - if (element) { - return resolve(element); - } - - const observer = new MutationObserver(() => { - const element = document.querySelector(selector); - if (element) { - resolve(element); - observer.disconnect(); - } - }); - - observer.observe(document.body, { - childList: true, - subtree: true, - once: true, - }); - }); -} - -const sleep = (m) => new Promise((r) => setTimeout(r, m)); - -const getVideoId = (service) => { - const url = new URL(window.location.href); - - switch (service) { - case "youtube": - return ( - url.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1] || - url.searchParams.get("v") - ); - case "vk": - if (url.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)) { - return url.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1); - } else if (url.searchParams.get("z")) { - return url.searchParams.get("z").split("/")[0]; - } else if (url.searchParams.get("oid") && url.searchParams.get("id")) { - return `video-${Math.abs( - url.searchParams.get("oid") - )}_${url.searchParams.get("id")}`; - } else { - return false; - } - case "9gag": - case "gag": - return url.pathname.match(/gag\/([^/]+)/)?.[1]; - case "twitch": - if (/^m\.twitch\.tv$/.test(window.location.hostname)) { - const linkUrl = document.head.querySelector('link[rel="canonical"]'); - return ( - linkUrl?.href.match(/videos\/([^/]+)/)?.[0] || url.pathname.slice(1) - ); - } else if (/^player\.twitch\.tv$/.test(window.location.hostname)) { - return `videos/${url.searchParams.get("video")}`; - } else if (/^clips\.twitch\.tv$/.test(window.location.hostname)) { - // get link to twitch channel (ex.: https://www.twitch.tv/xqc) - const channelLink = document.querySelector( - ".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']" - ); - if (!channelLink) { - return false; - } - - const channelName = channelLink.href.replace( - "https://www.twitch.tv/", - "" - ); - return `${channelName}/clip/${url.searchParams.get("clip")}`; - } else if (url.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)) { - return url.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]; - } else { - return url.pathname.match(/(?:videos)\/([^/]+)/)?.[0]; - } - case "tiktok": - return url.pathname.match(/video\/([^/]+)/)?.[1]; - case "vimeo": - return ( - url.pathname.match(/[^/]+\/[^/]+$/)?.[0] || - url.pathname.match(/[^/]+$/)?.[0] - ); - case "xvideos": - return url.pathname.match(/[^/]+\/[^/]+$/)?.[0]; - case "pornhub": - return ( - url.searchParams.get("viewkey") || - url.pathname.match(/embed\/([^/]+)/)?.[1] - ); - case "twitter": - return url.pathname.match(/status\/([^/]+)/)?.[1]; - case "udemy": - return url.pathname; - case "facebook": - return url.pathname; - case "rutube": - return url.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1]; - case "coub": - return url.pathname.match(/view\/([^/]+)/)?.[1]; - case "bilibili.com": - const bvid = url.searchParams.get("bvid"); - if (bvid) { - return bvid; - } else { - let vid = url.pathname.match(/video\/([^/]+)/)?.[1]; - if (vid && url.search && url.searchParams.get("p") !== null) { - vid += `/?p=${url.searchParams.get("p")}`; - } - return vid; - } - case "mail.ru": - if (url.pathname.startsWith("/v/") || url.pathname.startsWith("/mail/")) { - return url.pathname; - } else if (url.pathname.match(/video\/embed\/([^/]+)/)) { - const referer = document.querySelector( - ".b-video-controls__mymail-link" - ); - if (!referer) { - return false; - } - - return referer?.href.split("my.mail.ru")?.[1]; - } - default: - return false; - } -}; - -function secsToStrTime(secs) { - const minutes = Math.floor(secs / 60); - const seconds = Math.floor(secs % 60); - if (minutes >= 60) { - return translations[lang].translationTakeMoreThanHour; - } else if (minutes >= 10 && minutes % 10) { - return translations[lang].translationTakeApproximatelyMinutes.format( - minutes - ); - } else if (minutes == 1 || (minutes == 0 && seconds > 0)) { - return translations[lang].translationTakeAboutMinute; - } else { - return translations[lang].translationTakeApproximatelyMinute.format( - minutes - ); - } -} - -export { waitForElm, sleep, getVideoId, secsToStrTime }; diff --git a/src/src/utils/volume.js b/src/src/utils/volume.js deleted file mode 100644 index 8cb30e7c..00000000 --- a/src/src/utils/volume.js +++ /dev/null @@ -1,29 +0,0 @@ -// element - audio / video element -function syncVolume(element, sliderVolume, otherSliderVolume, tempVolume) { - let finalValue; - if (sliderVolume > tempVolume) { - // sliderVolume = 100 - // tempVolume = 69 - // volume = 15 - // 100 - 69 = 31 - // 15 + 31 = 46 - final video volume - finalValue = otherSliderVolume + (sliderVolume - tempVolume); - finalValue = finalValue > 100 ? 100 : Math.max(finalValue, 0); - - element.volume = finalValue / 100; - } else if (sliderVolume < tempVolume) { - // sliderVolume = 69 - // tempVolume = 100 - // volume = 15 - // 100 - 69 = 31 - // 15 - 31 = 0 - final video volume - finalValue = otherSliderVolume - (tempVolume - sliderVolume); - finalValue = finalValue > 100 ? 100 : Math.max(finalValue, 0); - - element.volume = finalValue / 100; - } - - return finalValue; -} - -export { syncVolume }; diff --git a/src/src/yandexRequests.js b/src/src/yandexRequests.js deleted file mode 100644 index 9ea590f8..00000000 --- a/src/src/yandexRequests.js +++ /dev/null @@ -1,97 +0,0 @@ -const VideoTranslationRequest = new protobuf.Type("VideoTranslationRequest") - .add(new protobuf.Field("url", 3, "string")) - .add(new protobuf.Field("deviceId", 4, "string")) - .add(new protobuf.Field("firstRequest", 5, "bool")) // true for the first request, false for subsequent ones - .add(new protobuf.Field("unknown1", 6, "fixed64")) - .add(new protobuf.Field("unknown2", 7, "int32")) // 1 1 - .add(new protobuf.Field("language", 8, "string")) // source language code - .add(new protobuf.Field("unknown3", 9, "int32")) // 0 0 - .add(new protobuf.Field("unknown4", 10, "int32")) // 0 0 - .add(new protobuf.Field("translationHelp", 11, "int32")) // array for translation assistance ([0] -> {2: link to video, 1: "video_file_url"}, [1] -> {2: link to subtitles, 1: "subtitles_file_url"}) - .add(new protobuf.Field("responseLanguage", 14, "string")); // target language code - -// const VideoWhitelistStreamRequest = new protobuf.Type("VideoWhitelistStreamRequest") -// .add(new protobuf.Field("url", 1, "string")) -// .add(new protobuf.Field("deviceId", 4, "string")) - -// const VideoTranslationStreamRequest = new protobuf.Type("VideoTranslationStreamRequest") -// .add(new protobuf.Field("url", 1, "string")) -// .add(new protobuf.Field("language", 2, "string")) -// .add(new protobuf.Field("responseLanguage", 3, "string")) - -const VideoTranslationResponse = new protobuf.Type("VideoTranslationResponse") - .add(new protobuf.Field("url", 1, "string")) - .add(new protobuf.Field("duration", 2, "double")) - .add(new protobuf.Field("status", 4, "int32")) // status - .add(new protobuf.Field("remainingTime", 5, "int32")) // secs before translation - .add(new protobuf.Field("language", 8, "string")) // detected language (if the wrong one is set) - .add(new protobuf.Field("message", 9, "string")); -// 6 - unknown 0 (1st request) -> 10 (2nd, 3th and etc requests) -// 7 - unknown array - -// const VideoWhitelistStreamResponse = new protobuf.Type("VideoWhitelistStreamResponse") -// .add(new protobuf.Field("inWhitelist", 1, "bool")) - -// const VideoTranslationStreamResponse = new protobuf.Type("VideoTranslationStreamResponse") -// .add(new protobuf.Field("unknown1", 1, "int32")) -// .add(new protobuf.Field("array", 2, "string")) -// .add(new protobuf.Field("ping", 3, "int32")) - -// Create a root namespace and add the types -// const root = new protobuf.Root().define("yandex").add(VideoWhitelistStreamRequest).add(VideoWhitelistStreamResponse); - -// // Export the encoding and decoding functions -// export const yandexRequests = { -// encodeRequest(url, deviceId, unknown1, requestLang, responseLang) { -// return root.VideoWhitelistStreamRequest.encode({ -// url, -// deviceId: 'UCLA_DiR1FfKNvjuUpBHmylQ' -// }).finish(); -// }, -// decodeResponse(response) { -// return root.VideoWhitelistStreamResponse.decode(new Uint8Array(response)); -// } -// }; - -// // Create a root namespace and add the types -// const root = new protobuf.Root().define("yandex").add(VideoTranslationStreamRequest).add(VideoTranslationStreamResponse); - -// // Export the encoding and decoding functions -// export const yandexRequests = { -// encodeRequest(url, deviceId, unknown1, requestLang, responseLang) { -// return root.VideoTranslationStreamRequest.encode({ -// url, -// language: requestLang, -// responseLanguage: responseLang -// }).finish(); -// }, -// decodeResponse(response) { -// return root.VideoTranslationStreamResponse.decode(new Uint8Array(response)); -// } -// }; - -// Create a root namespace and add the types -const root = new protobuf.Root() - .define("yandex") - .add(VideoTranslationRequest) - .add(VideoTranslationResponse); - -// Export the encoding and decoding functions -export const yandexRequests = { - encodeRequest(url, deviceId, unknown1, requestLang, responseLang) { - return root.VideoTranslationRequest.encode({ - url, - deviceId, - firstRequest: true, - unknown1, - unknown2: 1, - language: requestLang, - unknown3: 0, - unknown4: 0, - responseLanguage: responseLang, - }).finish(); - }, - decodeResponse(response) { - return root.VideoTranslationResponse.decode(new Uint8Array(response)); - }, -}; From db56540a0bbbfeb71e34ab7c3a6a6f533d310620 Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Sat, 22 Jul 2023 08:57:40 +0400 Subject: [PATCH 06/48] Delete src/dist directory --- src/dist/vot-cloudflare-min.user.js | 87 - src/dist/vot-cloudflare.user.js | 3896 --------------------------- src/dist/vot-min.user.js | 86 - src/dist/vot.user.js | 3815 -------------------------- 4 files changed, 7884 deletions(-) delete mode 100644 src/dist/vot-cloudflare-min.user.js delete mode 100644 src/dist/vot-cloudflare.user.js delete mode 100644 src/dist/vot-min.user.js delete mode 100644 src/dist/vot.user.js diff --git a/src/dist/vot-cloudflare-min.user.js b/src/dist/vot-cloudflare-min.user.js deleted file mode 100644 index 93020226..00000000 --- a/src/dist/vot-cloudflare-min.user.js +++ /dev/null @@ -1,87 +0,0 @@ -// ==UserScript== -// @name [VOT Cloudflare] - Voice Over Translation -// @name:de [VOT Cloudflare] - Voice-Over-Video-Übersetzung -// @name:es [VOT Cloudflare] - Traducción de vídeo en off -// @name:fr [VOT Cloudflare] - Traduction vidéo voix-off -// @name:it [VOT Cloudflare] - Traduzione Video fuori campo -// @name:ru [VOT Cloudflare] - Закадровый перевод видео -// @name:zh [VOT Cloudflare] - 画外音视频翻译 -// @description A small extension that adds a Yandex Browser video translation to other browsers -// @description:de Eine kleine Erweiterung, die eine Voice-over-Übersetzung von Videos aus dem Yandex-Browser zu anderen Browsern hinzufügt -// @description:es Una pequeña extensión que agrega una traducción de voz en off de un video de Yandex Browser a otros navegadores -// @description:fr Une petite extension qui ajoute la traduction vocale de la vidéo du Navigateur Yandex à d'autres navigateurs -// @description:it Una piccola estensione che aggiunge la traduzione vocale del video dal browser Yandex ad altri browser -// @description:ru Небольшое расширение, которое добавляет закадровый перевод видео из Яндекс Браузера в другие браузеры -// @description:zh 一个小扩展,它增加了视频从Yandex浏览器到其他浏览器的画外音翻译 -// @version 1.3.4-testing -// @author sodapng, mynovelhost, Toil, SashaXser -// @supportURL https://github.com/ilyhalight/voice-over-translation/issues -// @match *://*.youtube.com/* -// @match *://*.youtube-nocookie.com/* -// @match *://*.twitch.tv/* -// @match *://*.xvideos.com/* -// @match *://*.pornhub.com/* -// @match *://*.vk.com/* -// @match *://*.vk.ru/* -// @match *://invidious.snopyta.org/* -// @match *://invidious.kavin.rocks/* -// @match *://vid.puffyan.us/* -// @match *://invidious.namazso.eu/* -// @match *://inv.riverside.rocks/* -// @match *://yt.artemislena.eu/* -// @match *://invidious.flokinet.to/* -// @match *://invidious.esmailelbob.xyz/* -// @match *://invidious.nerdvpn.de/* -// @match *://invidious.slipfox.xyz/* -// @match *://invidio.xamh.de/* -// @match *://invidious.dhusch.de/* -// @match *://*.piped.video/* -// @match *://piped.tokhmi.xyz/* -// @match *://piped.moomoo.me/* -// @match *://piped.syncpundit.io/* -// @match *://piped.mha.fi/* -// @match *://watch.whatever.social/* -// @match *://piped.garudalinux.org/* -// @match *://efy.piped.pages.dev/* -// @match *://watch.leptons.xyz/* -// @match *://piped.lunar.icu/* -// @match *://yt.dc09.ru/* -// @match *://piped.mint.lgbt/* -// @match *://*.il.ax/* -// @match *://piped.privacy.com.de/* -// @match *://piped.esmailelbob.xyz/* -// @match *://piped.projectsegfau.lt/* -// @match *://piped.in.projectsegfau.lt/* -// @match *://piped.us.projectsegfau.lt/* -// @match *://piped.privacydev.net/* -// @match *://piped.palveluntarjoaja.eu/* -// @match *://piped.smnz.de/* -// @match *://piped.adminforge.de/* -// @match *://piped.qdi.fi/* -// @match *://piped.hostux.net/* -// @match *://piped.chauvet.pro/* -// @match *://piped.jotoma.de/* -// @match *://piped.pfcd.me/* -// @match *://piped.frontendfriendly.xyz/* -// @match *://*.yewtu.be/* -// @match *://inv.vern.cc/* -// @match *://*.vimeo.com/* -// @match *://*.9gag.com/* -// @match *://*.twitter.com/* -// @match *://*.facebook.com/* -// @match *://*.rutube.ru/* -// @match *://*.bilibili.com/* -// @match *://my.mail.ru/* -// @connect api.browser.yandex.ru -// @downloadURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js -// @grant GM_xmlhttpRequest -// @grant GM_info -// @homepageURL https://github.com/ilyhalight/voice-over-translation/issues -// @icon https://translate.yandex.ru/icons/favicon.ico -// @inject-into page -// @namespace vot-cloudflare -// @require https://cdnjs.cloudflare.com/ajax/libs/protobufjs/7.2.3/protobuf.min.js -// @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js -// ==/UserScript== - -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const $={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},Z=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,$=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let Z=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",Z);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:Z.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:Z.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),Z=await Y(Z,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),Z=await W(Z,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}function U(e,t=b){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t)}async function Y(e,t){switch(t){case"en":e.detectedLanguage=t,e.responseLanguage=b;break;case"ru":e.detectedLanguage=t,e.responseLanguage=b,"ru"==b&&(e.responseLanguage="en");break;default:if(!Object.keys(v.tW).includes(t))return Y(e,"en");e.detectedLanguage=t}return U(e.detectedLanguage,e.responseLanguage),e}async function W(e,t){if("en"===t)e.responseLanguage=t,e.detectedLanguage="ru";else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return U(e.detectedLanguage,e.responseLanguage),e}function G(){o.pause(),p.removeEventListener(".translate",G,!1),o.src="",o.removeAttribute("src"),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)y.Z.log(`lipsync mode is ${e}`),o.pause(),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(ee=Y(ee,ee.detectedLanguage),y.Z.log("VideoValidator videoData: ",Z),1===z&&ee.detectedLanguage===b)throw $=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if(Z.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,Z.detectedLanguage,Z.responseLanguage)};function ne(e){y.Z.log(`video ${e.type}`),J(e.type)}function oe(){G(),K()}function ae(t,a,i){!function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(`${v.g$[u]}${t}`,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),$=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),X(),function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,n)))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!$||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),$=!1}catch(e){O("error",String(e).substring(4,e.length)),$=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),$.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(Z);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/src/dist/vot-cloudflare.user.js b/src/dist/vot-cloudflare.user.js deleted file mode 100644 index 8318a36d..00000000 --- a/src/dist/vot-cloudflare.user.js +++ /dev/null @@ -1,3896 +0,0 @@ -// ==UserScript== -// @name [VOT Cloudflare] - Voice Over Translation -// @name:de [VOT Cloudflare] - Voice-Over-Video-Übersetzung -// @name:es [VOT Cloudflare] - Traducción de vídeo en off -// @name:fr [VOT Cloudflare] - Traduction vidéo voix-off -// @name:it [VOT Cloudflare] - Traduzione Video fuori campo -// @name:ru [VOT Cloudflare] - Закадровый перевод видео -// @name:zh [VOT Cloudflare] - 画外音视频翻译 -// @description A small extension that adds a Yandex Browser video translation to other browsers -// @description:de Eine kleine Erweiterung, die eine Voice-over-Übersetzung von Videos aus dem Yandex-Browser zu anderen Browsern hinzufügt -// @description:es Una pequeña extensión que agrega una traducción de voz en off de un video de Yandex Browser a otros navegadores -// @description:fr Une petite extension qui ajoute la traduction vocale de la vidéo du Navigateur Yandex à d'autres navigateurs -// @description:it Una piccola estensione che aggiunge la traduzione vocale del video dal browser Yandex ad altri browser -// @description:ru Небольшое расширение, которое добавляет закадровый перевод видео из Яндекс Браузера в другие браузеры -// @description:zh 一个小扩展,它增加了视频从Yandex浏览器到其他浏览器的画外音翻译 -// @version 1.3.4-testing -// @author sodapng, mynovelhost, Toil, SashaXser -// @supportURL https://github.com/ilyhalight/voice-over-translation/issues -// @match *://*.youtube.com/* -// @match *://*.youtube-nocookie.com/* -// @match *://*.twitch.tv/* -// @match *://*.xvideos.com/* -// @match *://*.pornhub.com/* -// @match *://*.vk.com/* -// @match *://*.vk.ru/* -// @match *://invidious.snopyta.org/* -// @match *://invidious.kavin.rocks/* -// @match *://vid.puffyan.us/* -// @match *://invidious.namazso.eu/* -// @match *://inv.riverside.rocks/* -// @match *://yt.artemislena.eu/* -// @match *://invidious.flokinet.to/* -// @match *://invidious.esmailelbob.xyz/* -// @match *://invidious.nerdvpn.de/* -// @match *://invidious.slipfox.xyz/* -// @match *://invidio.xamh.de/* -// @match *://invidious.dhusch.de/* -// @match *://*.piped.video/* -// @match *://piped.tokhmi.xyz/* -// @match *://piped.moomoo.me/* -// @match *://piped.syncpundit.io/* -// @match *://piped.mha.fi/* -// @match *://watch.whatever.social/* -// @match *://piped.garudalinux.org/* -// @match *://efy.piped.pages.dev/* -// @match *://watch.leptons.xyz/* -// @match *://piped.lunar.icu/* -// @match *://yt.dc09.ru/* -// @match *://piped.mint.lgbt/* -// @match *://*.il.ax/* -// @match *://piped.privacy.com.de/* -// @match *://piped.esmailelbob.xyz/* -// @match *://piped.projectsegfau.lt/* -// @match *://piped.in.projectsegfau.lt/* -// @match *://piped.us.projectsegfau.lt/* -// @match *://piped.privacydev.net/* -// @match *://piped.palveluntarjoaja.eu/* -// @match *://piped.smnz.de/* -// @match *://piped.adminforge.de/* -// @match *://piped.qdi.fi/* -// @match *://piped.hostux.net/* -// @match *://piped.chauvet.pro/* -// @match *://piped.jotoma.de/* -// @match *://piped.pfcd.me/* -// @match *://piped.frontendfriendly.xyz/* -// @match *://*.yewtu.be/* -// @match *://inv.vern.cc/* -// @match *://*.vimeo.com/* -// @match *://*.9gag.com/* -// @match *://*.twitter.com/* -// @match *://*.facebook.com/* -// @match *://*.rutube.ru/* -// @match *://*.bilibili.com/* -// @match *://my.mail.ru/* -// @connect api.browser.yandex.ru -// @downloadURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js -// @grant GM_xmlhttpRequest -// @grant GM_info -// @homepageURL https://github.com/ilyhalight/voice-over-translation/issues -// @icon https://translate.yandex.ru/icons/favicon.ico -// @inject-into page -// @namespace vot-cloudflare -// @require https://cdnjs.cloudflare.com/ajax/libs/protobufjs/7.2.3/protobuf.min.js -// @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js -// ==/UserScript== - -/******/ (() => { // webpackBootstrap -/******/ "use strict"; -/******/ var __webpack_modules__ = ({ - -/***/ "./node_modules/css-loader/dist/cjs.js!./src/styles/main.css": -/***/ ((module, __webpack_exports__, __webpack_require__) => { - -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./node_modules/css-loader/dist/runtime/noSourceMaps.js"); -/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./node_modules/css-loader/dist/runtime/api.js"); -/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__); -// Imports - - -var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default())); -// Module -___CSS_LOADER_EXPORT___.push([module.id, `.translationBlock { - padding: 0.45rem !important; - width: max-content; - position: absolute; - background: #2e2f34; - border-radius: 0.5rem !important; - left: 50%; - top: 5rem; - transform: translate(-50%); - text-align: center; - opacity: 0; - transition: opacity 1s; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - z-index: 100; -} - -.translationBtn { - position: relative; - display: inline-block; - vertical-align: middle; - color: #fff; - padding-right: 0.25rem !important; - cursor: pointer; - font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif; -} - -.translationBlock:hover { - opacity: 1; -} - -.translationMenu { - display: inline-block; - vertical-align: middle; - border-left: 1px solid #424348; - max-height: 16px; - max-width: 24px; - cursor: pointer; -} - -.translationMenuIcon { - padding: 0 10px !important; - width: 24px; -} - -.translationIAlice { - display: inline-block; - vertical-align: middle; - max-height: 26px; - max-width: 50px; -} - -.translationIconAlice { - height: 24px !important; - width: 24px !important; -} - -.translationITranslate { - display: inline-block; - vertical-align: middle; - max-height: 20px; - max-width: 20px; -} - -.translationMenuContent { - position: absolute; - background: #2e2f34; - color: #fff; - display: none; - border-radius: 1rem !important; - left: 50%; - top: 10rem; - transform: translate(-50%); - text-align: left; - font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important; - - width: 300px; - /* height: 375px; */ - opacity: 0; - z-index: 100; - transition: opacity 0.5s ease; -} - -.VOTMenuSlider { - -webkit-appearance: none !important; - appearance: none !important; - width: 268px !important; - height: 8px !important; - outline: none !important; - margin-top: 0.5rem; - opacity: 0.7; - /* background: #3C3F4D !important; */ - background: rgb(253, 222, 85, 0.6) !important; - border: none !important; - border-radius: 2rem !important; - -webkit-transition: 0.2s !important; - transition: opacity 0.2s ease !important; -} - -.VOTMenuSlider:hover { - opacity: 1; -} - -.VOTMenuSlider::-webkit-slider-thumb { - -webkit-appearance: none !important; - appearance: none !important; - width: 10px !important; - height: 10px !important; - border-radius: 50% !important; - border: none !important; - background: #fff !important; - cursor: pointer !important; -} - -.VOTMenuSlider::-moz-range-thumb { - width: 10px !important; - height: 10px !important; - border-radius: 50% !important; - border: none !important; - background: #fff !important; - cursor: pointer !important; -} - -.VOTMenuSlider::-ms-thumb { - width: 10px !important; - height: 10px !important; - border-radius: 50% !important; - border: none !important; - background: #fff !important; - cursor: pointer !important; -} - -.VOTMenuSlider::-ms-fill-lower { - height: 8px !important; - border-radius: 2rem !important; - background: linear-gradient( - 90.1deg, - rgba(186, 153, 244, 0.85) -5.78%, - rgba(236, 138, 202, 0.7) 56.46%, - rgba(239, 168, 117, 0.6) 108.93% - ) !important; -} - -.VOTMenuSlider::-moz-range-progress { - height: 8px !important; - border-radius: 2rem !important; - background: linear-gradient( - 90.1deg, - rgba(186, 153, 244, 0.85) -5.78%, - rgba(236, 138, 202, 0.7) 56.46%, - rgba(239, 168, 117, 0.6) 108.93% - ) !important; -} - -.translationHeader { - padding-bottom: 0.5rem !important; -} - -.translationMainHeader { - margin: 16px !important; - color: #fff; - font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important; -} - -.translationMenuOptions { - display: flex; - flex-flow: column wrap; -} - -.translationMenuContainer { - /* width: 100%; */ - padding-left: 16px !important; - padding-top: 5px !important; - display: inline-block !important; -} - -.translationMenuContainer > input { - appearance: auto !important; - vertical-align: text-bottom; -} - -.translationMenuText { - color: #fff; - display: inline-flex; - width: 80%; -} - -.translationVolumeBox, -.translationVideoVolumeBox { - padding-top: 0.5rem !important; -} - -.translationDropDB { - border: none !important; - border-radius: 4px !important; - background: #5426ff !important; - color: #fff !important; - padding: 6px 16px !important; - margin-left: auto !important; - cursor: pointer !important; -} - -.translationDownload { - background: #5426ff !important; - color: #fff !important; - padding: 2px 10px !important; - border-radius: 4px !important; - cursor: pointer; - display: none; -} - -.translationMenuFunctional { - display: flex; - margin: 16px !important; -} - -.VOTMenuSelect { - width: 110px; - border-radius: 5px !important; - border: 1px solid #dadce0 !important; - box-shadow: 0 1px 3px -2px #9098a9; - box-sizing: border-box !important; - color: #2e2f34 !important; - background: #fff !important; - padding: 5px !important; -} - -.VOTMenuSelect:focus { - outline: none; -} - -.VOTMenuSelect:focus { - outline: none; - border-color: #0077ff; - box-shadow: 0 0 0 2px rgba(#0077ff, 0.2); -} - -#VOTSelectLanguages { - display: flex !important; - margin-left: 5px; -} - -#VOTSelectLanguages svg { - margin: 0 5px; -} -`, ""]); -// Exports -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___); - - -/***/ }), - -/***/ "./node_modules/css-loader/dist/runtime/api.js": -/***/ ((module) => { - - - -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ -module.exports = function (cssWithMappingToString) { - var list = []; - - // return the list of modules as css string - list.toString = function toString() { - return this.map(function (item) { - var content = ""; - var needLayer = typeof item[5] !== "undefined"; - if (item[4]) { - content += "@supports (".concat(item[4], ") {"); - } - if (item[2]) { - content += "@media ".concat(item[2], " {"); - } - if (needLayer) { - content += "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {"); - } - content += cssWithMappingToString(item); - if (needLayer) { - content += "}"; - } - if (item[2]) { - content += "}"; - } - if (item[4]) { - content += "}"; - } - return content; - }).join(""); - }; - - // import a list of modules into the list - list.i = function i(modules, media, dedupe, supports, layer) { - if (typeof modules === "string") { - modules = [[null, modules, undefined]]; - } - var alreadyImportedModules = {}; - if (dedupe) { - for (var k = 0; k < this.length; k++) { - var id = this[k][0]; - if (id != null) { - alreadyImportedModules[id] = true; - } - } - } - for (var _k = 0; _k < modules.length; _k++) { - var item = [].concat(modules[_k]); - if (dedupe && alreadyImportedModules[item[0]]) { - continue; - } - if (typeof layer !== "undefined") { - if (typeof item[5] === "undefined") { - item[5] = layer; - } else { - item[1] = "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {").concat(item[1], "}"); - item[5] = layer; - } - } - if (media) { - if (!item[2]) { - item[2] = media; - } else { - item[1] = "@media ".concat(item[2], " {").concat(item[1], "}"); - item[2] = media; - } - } - if (supports) { - if (!item[4]) { - item[4] = "".concat(supports); - } else { - item[1] = "@supports (".concat(item[4], ") {").concat(item[1], "}"); - item[4] = supports; - } - } - list.push(item); - } - }; - return list; -}; - -/***/ }), - -/***/ "./node_modules/css-loader/dist/runtime/noSourceMaps.js": -/***/ ((module) => { - - - -module.exports = function (i) { - return i[1]; -}; - -/***/ }), - -/***/ "./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js": -/***/ ((module) => { - - - -var stylesInDOM = []; -function getIndexByIdentifier(identifier) { - var result = -1; - for (var i = 0; i < stylesInDOM.length; i++) { - if (stylesInDOM[i].identifier === identifier) { - result = i; - break; - } - } - return result; -} -function modulesToDom(list, options) { - var idCountMap = {}; - var identifiers = []; - for (var i = 0; i < list.length; i++) { - var item = list[i]; - var id = options.base ? item[0] + options.base : item[0]; - var count = idCountMap[id] || 0; - var identifier = "".concat(id, " ").concat(count); - idCountMap[id] = count + 1; - var indexByIdentifier = getIndexByIdentifier(identifier); - var obj = { - css: item[1], - media: item[2], - sourceMap: item[3], - supports: item[4], - layer: item[5] - }; - if (indexByIdentifier !== -1) { - stylesInDOM[indexByIdentifier].references++; - stylesInDOM[indexByIdentifier].updater(obj); - } else { - var updater = addElementStyle(obj, options); - options.byIndex = i; - stylesInDOM.splice(i, 0, { - identifier: identifier, - updater: updater, - references: 1 - }); - } - identifiers.push(identifier); - } - return identifiers; -} -function addElementStyle(obj, options) { - var api = options.domAPI(options); - api.update(obj); - var updater = function updater(newObj) { - if (newObj) { - if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap && newObj.supports === obj.supports && newObj.layer === obj.layer) { - return; - } - api.update(obj = newObj); - } else { - api.remove(); - } - }; - return updater; -} -module.exports = function (list, options) { - options = options || {}; - list = list || []; - var lastIdentifiers = modulesToDom(list, options); - return function update(newList) { - newList = newList || []; - for (var i = 0; i < lastIdentifiers.length; i++) { - var identifier = lastIdentifiers[i]; - var index = getIndexByIdentifier(identifier); - stylesInDOM[index].references--; - } - var newLastIdentifiers = modulesToDom(newList, options); - for (var _i = 0; _i < lastIdentifiers.length; _i++) { - var _identifier = lastIdentifiers[_i]; - var _index = getIndexByIdentifier(_identifier); - if (stylesInDOM[_index].references === 0) { - stylesInDOM[_index].updater(); - stylesInDOM.splice(_index, 1); - } - } - lastIdentifiers = newLastIdentifiers; - }; -}; - -/***/ }), - -/***/ "./node_modules/style-loader/dist/runtime/insertBySelector.js": -/***/ ((module) => { - - - -var memo = {}; - -/* istanbul ignore next */ -function getTarget(target) { - if (typeof memo[target] === "undefined") { - var styleTarget = document.querySelector(target); - - // Special case to return head of iframe instead of iframe itself - if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) { - try { - // This will throw an exception if access to iframe is blocked - // due to cross-origin restrictions - styleTarget = styleTarget.contentDocument.head; - } catch (e) { - // istanbul ignore next - styleTarget = null; - } - } - memo[target] = styleTarget; - } - return memo[target]; -} - -/* istanbul ignore next */ -function insertBySelector(insert, style) { - var target = getTarget(insert); - if (!target) { - throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid."); - } - target.appendChild(style); -} -module.exports = insertBySelector; - -/***/ }), - -/***/ "./node_modules/style-loader/dist/runtime/insertStyleElement.js": -/***/ ((module) => { - - - -/* istanbul ignore next */ -function insertStyleElement(options) { - var element = document.createElement("style"); - options.setAttributes(element, options.attributes); - options.insert(element, options.options); - return element; -} -module.exports = insertStyleElement; - -/***/ }), - -/***/ "./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js": -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - - -/* istanbul ignore next */ -function setAttributesWithoutAttributes(styleElement) { - var nonce = true ? __webpack_require__.nc : 0; - if (nonce) { - styleElement.setAttribute("nonce", nonce); - } -} -module.exports = setAttributesWithoutAttributes; - -/***/ }), - -/***/ "./node_modules/style-loader/dist/runtime/styleDomAPI.js": -/***/ ((module) => { - - - -/* istanbul ignore next */ -function apply(styleElement, options, obj) { - var css = ""; - if (obj.supports) { - css += "@supports (".concat(obj.supports, ") {"); - } - if (obj.media) { - css += "@media ".concat(obj.media, " {"); - } - var needLayer = typeof obj.layer !== "undefined"; - if (needLayer) { - css += "@layer".concat(obj.layer.length > 0 ? " ".concat(obj.layer) : "", " {"); - } - css += obj.css; - if (needLayer) { - css += "}"; - } - if (obj.media) { - css += "}"; - } - if (obj.supports) { - css += "}"; - } - var sourceMap = obj.sourceMap; - if (sourceMap && typeof btoa !== "undefined") { - css += "\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), " */"); - } - - // For old IE - /* istanbul ignore if */ - options.styleTagTransform(css, styleElement, options.options); -} -function removeStyleElement(styleElement) { - // istanbul ignore if - if (styleElement.parentNode === null) { - return false; - } - styleElement.parentNode.removeChild(styleElement); -} - -/* istanbul ignore next */ -function domAPI(options) { - if (typeof document === "undefined") { - return { - update: function update() {}, - remove: function remove() {} - }; - } - var styleElement = options.insertStyleElement(options); - return { - update: function update(obj) { - apply(styleElement, options, obj); - }, - remove: function remove() { - removeStyleElement(styleElement); - } - }; -} -module.exports = domAPI; - -/***/ }), - -/***/ "./node_modules/style-loader/dist/runtime/styleTagTransform.js": -/***/ ((module) => { - - - -/* istanbul ignore next */ -function styleTagTransform(css, styleElement) { - if (styleElement.styleSheet) { - styleElement.styleSheet.cssText = css; - } else { - while (styleElement.firstChild) { - styleElement.removeChild(styleElement.firstChild); - } - styleElement.appendChild(document.createTextNode(css)); - } -} -module.exports = styleTagTransform; - -/***/ }), - -/***/ "./src/config/config-cloudflare.js": -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ I: () => (/* binding */ yandexHmacKey), -/* harmony export */ i: () => (/* binding */ workerHost) -/* harmony export */ }); -// CLOUDFLARE CONFIGURATION -const workerHost = "vot.toil-dump.workers.dev"; -const yandexHmacKey = "gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"; - - - - -/***/ }), - -/***/ "./src/config/config.js": -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ IM: () => (/* binding */ autoVolume), -/* harmony export */ Rr: () => (/* binding */ yandexUserAgent) -/* harmony export */ }); -/* unused harmony exports workerHost, yandexHmacKey */ -// CONFIGURATION -const workerHost = "api.browser.yandex.ru"; -const yandexHmacKey = "gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"; -const yandexUserAgent = - "Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1"; -const autoVolume = 0.15; // 0.0 - 1.0 (0% - 100%) - default volume of the video with the translation - - - - -/***/ }), - -/***/ "./src/config/constants.js": -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ Iz: () => (/* binding */ translations), -/* harmony export */ ey: () => (/* binding */ translateFuncParam), -/* harmony export */ g$: () => (/* binding */ siteTranslates), -/* harmony export */ tW: () => (/* binding */ availableLangs) -/* harmony export */ }); -const translateFuncParam = 0x40_75_50_00_00_00_00_00; -const availableLangs = { - ru: "Russian", - en: "English", - zh: "Chinese", - fr: "French", - it: "Italian", - es: "Spanish", - de: "German", -}; // available languages for translation -const siteTranslates = { - youtube: "https://youtu.be/", - twitch: "https://twitch.tv/", - vimeo: "https://vimeo.com/", - "9gag": "https://9gag.com/gag/", - vk: "https://vk.com/video?z=", - xvideos: "https://www.xvideos.com/", - pornhub: "https://rt.pornhub.com/view_video.php?viewkey=", - udemy: "https://www.udemy.com", - twitter: "https://twitter.com/i/status/", - facebook: "https://www.facebook.com/", - rutube: "https://rutube.ru/video/", - "bilibili.com": "https://www.bilibili.com/video/", - "mail.ru": "https://my.mail.ru/", - coub: "https://coub.com/view/", -}; -const translations = { - ru: { - recommended: "рекомендуется", - translateVideo: "Перевести видео", - disableTranslate: "Выключить", - translationSettings: "Настройки перевода", - resetSettings: "Сбросить настройки", - videoBeingTranslated: "Видео переводится", - videoLanguage: "Язык видео", - translationLanguage: "Язык перевода", - translationTake: "Перевод займёт", - translationTakeMoreThanHour: "Перевод займёт больше часа", - translationTakeAboutMinute: "Перевод займёт около минуты", - translationTakeFewMinutes: "Перевод займёт несколько минут", - translationTakeApproximatelyMinutes: "Перевод займёт примерно {0} минут", - translationTakeApproximatelyMinute: "Перевод займёт примерно {0} минуты", - unSupportedExtensionError: `Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`, - requestTranslationFailed: "Не удалось запросить перевод видео", - audioNotReceived: "Не получена ссылка на аудио", - grantPermissionToAutoPlay: "Предоставьте разрешение на автовоспроизведение", - neededAdditionalExtension: - "Для поддержки этого сайта необходимо дополнительное расширение", - audioFormatNotSupported: "Формат аудио не поддерживается", - VOTAutoTranslate: "Переводить при открытии", - VOTDontTranslateYourLang: "Не переводить с родного языка", - VOTVolume: "Громкость видео", - VOTVolumeTranslation: "Громкость перевода", - VOTAutoSetVolume: "Уменьшать громкость видео до ", - VOTShowVideoSlider: "Слайдер громкости видео", - VOTSyncVolume: "Связать громкость перевода и видео", - VOTAudioProxy: "Проксировать полученное аудио", - VOTDisableFromYourLang: "VOT: Вы отключили перевод видео на вашем языке", - VOTLiveNotSupported: - "VOT: Не поддерживается перевод трансляций в прямом эфире", - VOTPremiere: "VOT: Дождитесь окончания премьеры перед переводом", - VOTVideoIsTooLong: "VOT: Видео слишком длинное", - VOTNoVideoIDFound: "VOT: Не найдено ID видео", - VOTFailedInitDB: "VOT: Не удалось инициализовать базу данных", - VOTDBNeedUpdate: - "VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу", - VOTDisabledForDBUpdating: `VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`, - VOTFailedWriteToDB: "VOT: Не удалось записать данные в базу данных", - VOTFailedReadFromDB: "VOT: Не удалось получить данные из базы данных", - Russian: "Русский", - English: "Английский", - Chinese: "Китайский", - French: "Французский", - Italian: "Итальянский", - Spanish: "Испанский", - German: "Немецкий", - }, - en: { - recommended: "recommended", - translateVideo: "Translate video", - disableTranslate: "Turn off", - translationSettings: "Translation settings", - resetSettings: "Reset settings", - videoBeingTranslated: "The video is being translated", - videoLanguage: "Video language", - translationLanguage: "Translation language", - translationTake: "The translation will take", - translationTakeMoreThanHour: "The translation will take more than an hour", - translationTakeAboutMinute: "The translation will take about a minute", - translationTakeFewMinutes: "The translation will take a few minutes", - translationTakeApproximatelyMinutes: - "The translation will take approximately {0} minutes", - translationTakeApproximatelyMinute: - "The translation will take approximately {0} minutes", - unSupportedExtensionError: `Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`, - requestTranslationFailed: "Failed to request video translation", - audioNotReceived: "Audio link not received", - grantPermissionToAutoPlay: "Grant permission to autoplay", - neededAdditionalExtension: - "An additional extension is needed to support this site", - audioFormatNotSupported: "The audio format is not supported", - VOTAutoTranslate: "Translate on open", - VOTDontTranslateYourLang: "Do not translate from my language", - VOTVolume: "Video volume", - VOTVolumeTranslation: "Translation Volume", - VOTAutoSetVolume: "Reduce video volume to ", - VOTShowVideoSlider: "Video volume slider", - VOTSyncVolume: "Link translation and video volume", - VOTAudioProxy: "Proxy received audio", - VOTDisableFromYourLang: - "VOT: You have disabled the translation of the video in your language", - VOTLiveNotSupported: "VOT: Translation of live streams is not supported", - VOTPremiere: "VOT: Wait for the premiere to end before translating", - VOTVideoIsTooLong: "VOT: Video is too long", - VOTNoVideoIDFound: "VOT: No video ID found", - VOTFailedInitDB: "VOT: Failed to initialize database", - VOTDBNeedUpdate: - "VOT: The database needs an update, please reload the page", - VOTDisabledForDBUpdating: `VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`, - VOTFailedWriteToDB: "VOT: Data could not be written to the database", - VOTFailedReadFromDB: "VOT: Data could not be retrieved from the database", - Russian: "Russian", - English: "English", - Chinese: "Chinese", - French: "French", - Italian: "Italian", - Spanish: "Spanish", - German: "German", - }, - zh: { - recommended: "推荐使用", - translateVideo: "翻译视频", - disableTranslate: "关掉", - translationSettings: "翻译需要一个多小时", - resetSettings: "重置设置", - videoBeingTranslated: "视频正在翻译中", - videoLanguage: "视频语言", - translationLanguage: "翻译语言", - translationTake: "翻译将采取", - translationTakeMoreThanHour: "翻译将采取一个多小时", - translationTakeAboutMinute: "翻译将采取一分钟", - translationTakeFewMinutes: "翻译将采取几分钟", - translationTakeApproximatelyMinutes: "翻译将采取大约需要{0}分钟", - translationTakeApproximatelyMinute: "翻译将采取大约需要{0}分钟", - unSupportedExtensionError: `错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`, - requestTranslationFailed: "请求视频翻译失败", - audioNotReceived: "未收到音频链接", - grantPermissionToAutoPlay: "授予自动播放权限", - neededAdditionalExtension: "需要一个额外的扩展来支持这个网站", - audioFormatNotSupported: "不支持音频格式", - VOTAutoTranslate: "打开时翻译", - VOTDontTranslateYourLang: "不要从你的语言翻译过来", - VOTVolume: "视频量", - VOTVolumeTranslation: "翻译量", - VOTAutoSetVolume: "将视频音量降低到", - VOTShowVideoSlider: "视频音量滑块", - VOTSyncVolume: "链接翻译和视频音量", - VOTAudioProxy: "代理接收的音频", - VOTDisableFromYourLang: "VOT:你已经禁用了你的语言的视频翻译", - VOTLiveNotSupported: "VOT:不支持直播流的翻译", - VOTPremiere: "VOT:等待首映结束后再翻译", - VOTVideoIsTooLong: "VOT:视频太长", - VOTNoVideoIDFound: "VOT: 没有找到视频ID", - VOTFailedInitDB: "VOT: 初始化数据库失败", - VOTDBNeedUpdate: "VOT: 数据库需要更新,请重新加载页面", - VOTDisabledForDBUpdating: `VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`, - VOTFailedWriteToDB: "VOT: 无法将数据写入数据库", - VOTFailedReadFromDB: "VOT: 无法从数据库中检索数据", - Russian: "俄语", - English: "英语", - Chinese: "中文", - French: "法语", - Italian: "意大利语", - Spanish: "西班牙语", - German: "德语", - }, - de: { - recommended: "es wird empfohlen", - translateVideo: "Video übersetzen", - disableTranslate: "Ausschalten", - translationSettings: "Übersetzungseinstellungen", - resetSettings: "Einstellungen zurücksetzen", - videoBeingTranslated: "Das Video wird übersetzt", - videoLanguage: "Sprache Video", - translationLanguage: "Zielsprache", - translationTake: "Die Übersetzung dauert", - translationTakeMoreThanHour: "Die Übersetzung dauert mehr als eine Stunde", - translationTakeAboutMinute: "Die Übersetzung dauert ungefähr eine Minute", - translationTakeFewMinutes: "Die Übersetzung dauert einige Minuten", - translationTakeApproximatelyMinutes: - "Die Übersetzung dauert ungefähr {0} Minuten", - translationTakeApproximatelyMinute: - "Die Übersetzung dauert ungefähr {0} Minuten", - unSupportedExtensionError: `Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`, - requestTranslationFailed: - "Videoübersetzung konnte nicht angefordert werden", - audioNotReceived: "Audiolink nicht empfangen", - grantPermissionToAutoPlay: - "Erteilen Sie die Berechtigung zur automatischen Wiedergabe", - neededAdditionalExtension: - "Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen", - audioFormatNotSupported: "Das Audioformat wird nicht unterstützt", - VOTAutoTranslate: "Beim Öffnen übersetzen", - VOTDontTranslateYourLang: "Nicht aus Ihrer Sprache übersetzen", - VOTVolume: "Video Lautstärke", - VOTVolumeTranslation: "Übersetzungsvolumen", - VOTAutoSetVolume: "Video-Lautstärke auf reduzieren ", - VOTShowVideoSlider: "Video-Lautstärkeregler", - VOTSyncVolume: "Übersetzungs- und Videolautstärke verknüpfen", - VOTAudioProxy: "Empfangenes Audio proxyen", - VOTDisableFromYourLang: - "VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert", - VOTLiveNotSupported: - "VOT: Übersetzung von Live-Streams wird nicht unterstützt", - VOTPremiere: - "VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen", - VOTVideoIsTooLong: "VOT: Video ist zu lang", - VOTNoVideoIDFound: "VOT: Keine Video-ID gefunden", - VOTFailedInitDB: "VOT: Datenbank konnte nicht initialisiert werden", - VOTDBNeedUpdate: - "VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu", - VOTDisabledForDBUpdating: `VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`, - VOTFailedWriteToDB: - "VOT: Daten konnten nicht in die Datenbank geschrieben werden", - VOTFailedReadFromDB: "VOT: Konnte keine Daten aus der Datenbank abrufen", - Russian: "Russisch", - English: "Englisch", - Chinese: "Chinesisch", - French: "Französisch", - Italian: "Italienisch", - Spanish: "Spanisch", - German: "Deutsch", - }, - es: { - recommended: "es recomendable", - translateVideo: "Traducir video", - disableTranslate: "Apagar", - translationSettings: "Ajustes de traducción", - resetSettings: "Restablecer ajustes", - videoBeingTranslated: "El video está siendo traducido", - videoLanguage: "Idioma del video", - translationLanguage: "Idioma de la traducción", - translationTake: "La traducción tardará", - translationTakeMoreThanHour: "La traducción tardará más de una hora", - translationTakeAboutMinute: - "La traducción tardará aproximadamente un minuto", - translationTakeFewMinutes: "La traducción tardará unos minutos", - translationTakeApproximatelyMinutes: - "La traducción tardará aproximadamente {0} minutos", - translationTakeApproximatelyMinute: - "La traducción tardará aproximadamente {0} minutos", - unSupportedExtensionError: `Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`, - requestTranslationFailed: "Error al solicitar la traducción de vídeo", - audioNotReceived: "Audiolink nicht empfangen", - grantPermissionToAutoPlay: "Conceder permiso de reproducción automática", - neededAdditionalExtension: - "Se necesita una extensión adicional para admitir este sitio", - audioFormatNotSupported: "El formato de audio no es compatible", - VOTAutoTranslate: "Traducir al abrir", - VOTDontTranslateYourLang: "No traduzca de su lengua", - VOTVolume: "Volumen de vídeo", - VOTVolumeTranslation: "Volumen de traducción", - VOTAutoSetVolume: "Reducir el volumen del video al ", - VOTShowVideoSlider: "Deslizador de volumen de video", - VOTSyncVolume: "Vincular el volumen de traducción y video", - VOTAudioProxy: "Proxificar el audio recibido", - VOTDisableFromYourLang: - "VOT: Ha desactivado la traducción del vídeo en su idioma", - VOTLiveNotSupported: - "VOT: No se admite la traducción de transmisiones en vivo", - VOTPremiere: "VOT: Espere a que termine el estreno antes de traducir", - VOTVideoIsTooLong: "VOT: El video es demasiado largo", - VOTNoVideoIDFound: "VOT: No se encontró id de video", - VOTFailedInitDB: "VOT: No se pudo inicializar la base de datos", - VOTDBNeedUpdate: - "VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página", - VOTDisabledForDBUpdating: `VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`, - VOTFailedWriteToDB: "VOT: No se pudo escribir datos en la base de datos", - VOTFailedReadFromDB: "VOT: No se pudo recuperar datos de la base de datos", - Russian: "Ruso", - English: "Inglés", - Chinese: "Chino", - French: "Francés", - Italian: "Italiano", - Spanish: "Español", - German: "Alemán", - }, - fr: { - recommended: "recommande", - translateVideo: "Traduire la vidéo", - disableTranslate: "Désactiver", - translationSettings: "Paramètres de traduction", - resetSettings: "Réinitialiser les paramètres", - videoBeingTranslated: "La vidéo est en cours de traduction", - videoLanguage: "Langue vidéo", - translationLanguage: "Langue cible", - translationTake: "La traduction prendra", - translationTakeMoreThanHour: "La traduction prendra plus d'une heure", - translationTakeAboutMinute: "La traduction prendra environ une minute", - translationTakeFewMinutes: "La traduction prendra quelques minutes", - translationTakeApproximatelyMinutes: - "La traduction prendra environ {0} minutes", - translationTakeApproximatelyMinute: - "La traduction prendra environ {0} minutes", - unSupportedExtensionError: `Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`, - requestTranslationFailed: - "Impossible de demander la traduction de la vidéo", - audioNotReceived: "Lien audio non reçu", - grantPermissionToAutoPlay: "Accorder l'autorisation de lecture automatique", - neededAdditionalExtension: - "Une extension supplémentaire est nécessaire pour prendre en charge ce site", - audioFormatNotSupported: "Format audio non pris en charge", - VOTAutoTranslate: "Traduire à l'ouverture", - VOTDontTranslateYourLang: "Ne pas traduire à partir de votre langue", - VOTVolume: "Volume de la vidéo", - VOTVolumeTranslation: "Volume de traduction", - VOTAutoSetVolume: "Réduire le volume de la vidéo à ", - VOTShowVideoSlider: "Curseur de volume vidéo", - VOTSyncVolume: "Lier le volume de la traduction et de la vidéo", - VOTAudioProxy: "Proxy audio reçu", - VOTDisableFromYourLang: - "VOT: Vous avez désactivé la traduction de la vidéo dans votre langue", - VOTLiveNotSupported: - "VOT: La traduction des flux en direct n'est pas prise en charge", - VOTPremiere: "VOT: Attendez la fin de la première avant de traduire", - VOTVideoIsTooLong: "VOT: La vidéo est trop longue", - VOTNoVideoIDFound: "VOT: ID vidéo introuvable", - VOTFailedInitDB: "VOT: Impossible d'initialiser la base de données", - VOTDBNeedUpdate: - "VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page", - VOTDisabledForDBUpdating: `VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`, - VOTFailedWriteToDB: - "VOT: Impossible d'écrire les données dans la base de données", - VOTFailedReadFromDB: - "VOT: Impossible de récupérer les données de la base de données", - Russian: "Russe", - English: "Anglais", - Chinese: "Chinois", - French: "Français", - Italian: "Italien", - Spanish: "Espagnol", - German: "Allemand", - }, - it: { - recommended: "è consigliabile", - translateVideo: "Traduci il video", - disableTranslate: "Spegnere", - translationSettings: "Impostazioni di traduzione", - resetSettings: "Ripristina impostazioni", - videoBeingTranslated: "Il video è in fase di traduzione", - videoLanguage: "Lingua Video", - translationLanguage: "Lingua di traduzione", - translationTake: "La traduzione richiederà", - translationTakeMoreThanHour: "La traduzione richiederà più di un'ora", - translationTakeAboutMinute: "La traduzione richiederà circa un minuto", - translationTakeFewMinutes: "La traduzione richiederà alcuni minuti", - translationTakeApproximatelyMinutes: - "La traduzione richiederà circa {0} minuti", - translationTakeApproximatelyMinute: - "La traduzione richiederà circa {0} minuti", - unSupportedExtensionError: `Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`, - requestTranslationFailed: "Richiesta di traduzione video non riuscita", - audioNotReceived: "Collegamento audio non ricevuto", - grantPermissionToAutoPlay: - "Concedere l'Autorizzazione per la riproduzione automatica", - neededAdditionalExtension: - "Per supportare questo sito è necessaria un'estensione aggiuntiva", - audioFormatNotSupported: "Il formato audio non è supportato", - VOTAutoTranslate: "Traduci all'apertura", - VOTDontTranslateYourLang: "Non traducete dalla vostra lingua", - VOTVolume: "Volume video", - VOTVolumeTranslation: "Volume di traduzione", - VOTAutoSetVolume: "Riduci il volume del video al ", - VOTShowVideoSlider: "Cursore del volume del video", - VOTSyncVolume: "Collega il volume della traduzione e del video", - VOTAudioProxy: "Proxy audio ricevuto", - VOTDisableFromYourLang: - "VOT: Avete disabilitato la traduzione del video nella vostra lingua", - VOTLiveNotSupported: - "VOT: La traduzione dei flussi dal vivo non è supportata", - VOTPremiere: "VOT: Aspetta che la prima finisca prima di tradurre", - VOTVideoIsTooLong: "VOT: Il video è troppo lungo", - VOTNoVideoIDFound: "VOT: ID video non trovato", - VOTFailedInitDB: "VOT: Impossibile inizializzare il database", - VOTDBNeedUpdate: - "VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina", - VOTDisabledForDBUpdating: `VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`, - VOTFailedWriteToDB: "VOT: Impossibile scrivere dati nel database", - VOTFailedReadFromDB: "VOT: Impossibile recuperare i dati dal database", - Russian: "Russo", - English: "Inglese", - Chinese: "Cinese", - French: "Francese", - Italian: "Italiano", - Spanish: "Spagnolo", - German: "Tedesco", - }, -}; - - - - -/***/ }), - -/***/ "./src/rvt-cloudflare.js": -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -// ESM COMPAT FLAG -__webpack_require__.r(__webpack_exports__); - -// EXPORTS -__webpack_require__.d(__webpack_exports__, { - "default": () => (/* binding */ rvt_cloudflare) -}); - -;// CONCATENATED MODULE: ./src/getUUID.js -function getUUID(isLower) { - const uuid = ([1e7] + 1e3 + 4e3 + 8e3 + 1e11).replace(/[018]/g, (c) => - ( - c ^ - (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4))) - ).toString(16) - ); - return isLower ? uuid : uuid.toUpperCase(); -} - - - -// EXTERNAL MODULE: ./src/yandexRequests.js -var yandexRequests = __webpack_require__("./src/yandexRequests.js"); -// EXTERNAL MODULE: ./src/config/config-cloudflare.js -var config_cloudflare = __webpack_require__("./src/config/config-cloudflare.js"); -// EXTERNAL MODULE: ./src/config/config.js -var config = __webpack_require__("./src/config/config.js"); -// EXTERNAL MODULE: ./src/utils/debug.js -var debug = __webpack_require__("./src/utils/debug.js"); -;// CONCATENATED MODULE: ./src/rvt-cloudflare.js - - - - - - -// Request video translation from Yandex API -async function requestVideoTranslation( - url, - unknown1, - requestLang, - responseLang, - callback -) { - // Initialize variables - let response; - let responseBody; - const deviceId = getUUID(true); - const body = yandexRequests/* yandexRequests */.G.encodeRequest( - url, - deviceId, - unknown1, - requestLang, - responseLang - ); - - try { - debug/* default */.Z.log("requestVideoTranslation"); - // Create a key from the HMAC secret - const utf8Encoder = new TextEncoder("utf-8"); - const key = await window.crypto.subtle.importKey( - "raw", - utf8Encoder.encode(config_cloudflare/* yandexHmacKey */.I), - { name: "HMAC", hash: { name: "SHA-256" } }, - false, - ["sign", "verify"] - ); - // Sign the body with the key - const signature = await window.crypto.subtle.sign("HMAC", key, body); - // Convert the signature to a hex string - const hexSignature = Array.from(new Uint8Array(signature), (x) => - x.toString(16).padStart(2, "0") - ).join(""); - // Create a fetch options object with headers and body - const options = { - method: "POST", - mode: "cors", - cache: "no-cache", - headers: { - "Content-Type": "application/json", - }, - redirect: "follow", - referrerPolicy: "no-referrer", - body: JSON.stringify({ - headers: { - Accept: "application/x-protobuf", - "Accept-Language": "en", - "Content-Type": "application/x-protobuf", - "User-Agent": config/* yandexUserAgent */.Rr, - Pragma: "no-cache", - "Cache-Control": "no-cache", - "Sec-Fetch-Mode": "no-cors", - "Vtrans-Signature": hexSignature, - "Sec-Vtrans-Token": getUUID(false), - }, - body: String.fromCharCode(...body), - }), - }; - // Fetch the translation from the worker host - response = await fetch( - `https://${config_cloudflare/* workerHost */.i}/video-translation/translate`, - options - ); - // Get the response body as an array buffer - responseBody = await response.arrayBuffer(); - } catch (exception) { - debug/* default */.Z.log(exception); - // Handle errors - response = { status: -1 }; - responseBody = exception; - } - - // Call the callback function with the result - callback(response.status == 200, responseBody); -} - -/* harmony default export */ const rvt_cloudflare = (requestVideoTranslation); - - -/***/ }), - -/***/ "./src/utils/debug.js": -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony import */ var _config_constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./src/config/constants.js"); - - -const debug = {}; -debug.log = (...text) => { - if (true) { - return; - } - return console.log( - "%c[VOT DEBUG]", - "background: #F2452D; color: #fff; padding: 5px;", - ...text - ); -}; - -debug.translations = (testLang) => { - if (true) { - return; - } - // for add indexes - const testedTranslations = Object.entries(_config_constants_js__WEBPACK_IMPORTED_MODULE_0__/* .translations */ .Iz[testLang]).map( - ([key, value]) => ({ - phrase: key, - translated: value, - }) - ); - testedTranslations.unshift({ - phrase: "language_code (debug only)", - translated: testLang, - }); - return console.table(testedTranslations); -}; - -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (debug); - - -/***/ }), - -/***/ "./src/yandexRequests.js": -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ G: () => (/* binding */ yandexRequests) -/* harmony export */ }); -const VideoTranslationRequest = new protobuf.Type("VideoTranslationRequest") - .add(new protobuf.Field("url", 3, "string")) - .add(new protobuf.Field("deviceId", 4, "string")) - .add(new protobuf.Field("firstRequest", 5, "bool")) // true for the first request, false for subsequent ones - .add(new protobuf.Field("unknown1", 6, "fixed64")) - .add(new protobuf.Field("unknown2", 7, "int32")) // 1 1 - .add(new protobuf.Field("language", 8, "string")) // source language code - .add(new protobuf.Field("unknown3", 9, "int32")) // 0 0 - .add(new protobuf.Field("unknown4", 10, "int32")) // 0 0 - .add(new protobuf.Field("translationHelp", 11, "int32")) // array for translation assistance ([0] -> {2: link to video, 1: "video_file_url"}, [1] -> {2: link to subtitles, 1: "subtitles_file_url"}) - .add(new protobuf.Field("responseLanguage", 14, "string")); // target language code - -// const VideoWhitelistStreamRequest = new protobuf.Type("VideoWhitelistStreamRequest") -// .add(new protobuf.Field("url", 1, "string")) -// .add(new protobuf.Field("deviceId", 4, "string")) - -// const VideoTranslationStreamRequest = new protobuf.Type("VideoTranslationStreamRequest") -// .add(new protobuf.Field("url", 1, "string")) -// .add(new protobuf.Field("language", 2, "string")) -// .add(new protobuf.Field("responseLanguage", 3, "string")) - -const VideoTranslationResponse = new protobuf.Type("VideoTranslationResponse") - .add(new protobuf.Field("url", 1, "string")) - .add(new protobuf.Field("duration", 2, "double")) - .add(new protobuf.Field("status", 4, "int32")) // status - .add(new protobuf.Field("remainingTime", 5, "int32")) // secs before translation - .add(new protobuf.Field("language", 8, "string")) // detected language (if the wrong one is set) - .add(new protobuf.Field("message", 9, "string")); -// 6 - unknown 0 (1st request) -> 10 (2nd, 3th and etc requests) -// 7 - unknown array - -// const VideoWhitelistStreamResponse = new protobuf.Type("VideoWhitelistStreamResponse") -// .add(new protobuf.Field("inWhitelist", 1, "bool")) - -// const VideoTranslationStreamResponse = new protobuf.Type("VideoTranslationStreamResponse") -// .add(new protobuf.Field("unknown1", 1, "int32")) -// .add(new protobuf.Field("array", 2, "string")) -// .add(new protobuf.Field("ping", 3, "int32")) - -// Create a root namespace and add the types -// const root = new protobuf.Root().define("yandex").add(VideoWhitelistStreamRequest).add(VideoWhitelistStreamResponse); - -// // Export the encoding and decoding functions -// export const yandexRequests = { -// encodeRequest(url, deviceId, unknown1, requestLang, responseLang) { -// return root.VideoWhitelistStreamRequest.encode({ -// url, -// deviceId: 'UCLA_DiR1FfKNvjuUpBHmylQ' -// }).finish(); -// }, -// decodeResponse(response) { -// return root.VideoWhitelistStreamResponse.decode(new Uint8Array(response)); -// } -// }; - -// // Create a root namespace and add the types -// const root = new protobuf.Root().define("yandex").add(VideoTranslationStreamRequest).add(VideoTranslationStreamResponse); - -// // Export the encoding and decoding functions -// export const yandexRequests = { -// encodeRequest(url, deviceId, unknown1, requestLang, responseLang) { -// return root.VideoTranslationStreamRequest.encode({ -// url, -// language: requestLang, -// responseLanguage: responseLang -// }).finish(); -// }, -// decodeResponse(response) { -// return root.VideoTranslationStreamResponse.decode(new Uint8Array(response)); -// } -// }; - -// Create a root namespace and add the types -const root = new protobuf.Root() - .define("yandex") - .add(VideoTranslationRequest) - .add(VideoTranslationResponse); - -// Export the encoding and decoding functions -const yandexRequests = { - encodeRequest(url, deviceId, unknown1, requestLang, responseLang) { - return root.VideoTranslationRequest.encode({ - url, - deviceId, - firstRequest: true, - unknown1, - unknown2: 1, - language: requestLang, - unknown3: 0, - unknown4: 0, - responseLanguage: responseLang, - }).finish(); - }, - decodeResponse(response) { - return root.VideoTranslationResponse.decode(new Uint8Array(response)); - }, -}; - - -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ // Check if module is in cache -/******/ var cachedModule = __webpack_module_cache__[moduleId]; -/******/ if (cachedModule !== undefined) { -/******/ return cachedModule.exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = __webpack_module_cache__[moduleId] = { -/******/ id: moduleId, -/******/ // no module.loaded needed -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/compat get default export */ -/******/ (() => { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = (module) => { -/******/ var getter = module && module.__esModule ? -/******/ () => (module['default']) : -/******/ () => (module); -/******/ __webpack_require__.d(getter, { a: getter }); -/******/ return getter; -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/define property getters */ -/******/ (() => { -/******/ // define getter functions for harmony exports -/******/ __webpack_require__.d = (exports, definition) => { -/******/ for(var key in definition) { -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ (() => { -/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) -/******/ })(); -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ (() => { -/******/ // define __esModule on exports -/******/ __webpack_require__.r = (exports) => { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/nonce */ -/******/ (() => { -/******/ __webpack_require__.nc = undefined; -/******/ })(); -/******/ -/************************************************************************/ -var __webpack_exports__ = {}; -// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. -(() => { - -// EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js -var injectStylesIntoStyleTag = __webpack_require__("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"); -var injectStylesIntoStyleTag_default = /*#__PURE__*/__webpack_require__.n(injectStylesIntoStyleTag); -// EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/styleDomAPI.js -var styleDomAPI = __webpack_require__("./node_modules/style-loader/dist/runtime/styleDomAPI.js"); -var styleDomAPI_default = /*#__PURE__*/__webpack_require__.n(styleDomAPI); -// EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/insertBySelector.js -var insertBySelector = __webpack_require__("./node_modules/style-loader/dist/runtime/insertBySelector.js"); -var insertBySelector_default = /*#__PURE__*/__webpack_require__.n(insertBySelector); -// EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js -var setAttributesWithoutAttributes = __webpack_require__("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"); -var setAttributesWithoutAttributes_default = /*#__PURE__*/__webpack_require__.n(setAttributesWithoutAttributes); -// EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/insertStyleElement.js -var insertStyleElement = __webpack_require__("./node_modules/style-loader/dist/runtime/insertStyleElement.js"); -var insertStyleElement_default = /*#__PURE__*/__webpack_require__.n(insertStyleElement); -// EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/styleTagTransform.js -var styleTagTransform = __webpack_require__("./node_modules/style-loader/dist/runtime/styleTagTransform.js"); -var styleTagTransform_default = /*#__PURE__*/__webpack_require__.n(styleTagTransform); -// EXTERNAL MODULE: ./node_modules/css-loader/dist/cjs.js!./src/styles/main.css -var main = __webpack_require__("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"); -;// CONCATENATED MODULE: ./src/styles/main.css - - - - - - - - - - - -var options = {}; - -options.styleTagTransform = (styleTagTransform_default()); -options.setAttributes = (setAttributesWithoutAttributes_default()); - - options.insert = insertBySelector_default().bind(null, "head"); - -options.domAPI = (styleDomAPI_default()); -options.insertStyleElement = (insertStyleElement_default()); - -var update = injectStylesIntoStyleTag_default()(main/* default */.Z, options); - - - - - /* harmony default export */ const styles_main = (main/* default */.Z && main/* default */.Z.locals ? main/* default */.Z.locals : undefined); - -;// CONCATENATED MODULE: ./src/utils/getYTVideoData.js -async function detect(cleanText) { - const response = await fetch("https://rust-server-531j.onrender.com/detect", { - method: "POST", - body: cleanText, - }); - return await response.text(); -} - -// Get the language code from the response or the text -async function getLanguage(player, response, title, description, author) { - if (!window.location.hostname.includes("m.youtube.com")) { - // ! Experimental ! get lang from selected audio track if availabled - const audioTracks = player.getAudioTrack(); - const trackInfo = audioTracks?.getLanguageInfo(); // get selected track info (id === "und" if tracks are not available) - if (trackInfo?.id !== "und") { - return trackInfo.id.split(".")[0]; - } - } - - // TODO: If the audio tracks will work fine, transfer the receipt of captions to the audioTracks variable - // Check if there is an automatic caption track in the response - const captionTracks = - response?.captions?.playerCaptionsTracklistRenderer?.captionTracks; - if (captionTracks?.length) { - const autoCaption = captionTracks.find((caption) => caption.kind === "asr"); - if (autoCaption) { - return autoCaption.languageCode; - } - } - // If there is no caption track, use detect to get the language code from the text - const text = [title, description, author].join(" "); - // Remove anything that is not a letter or a space in any language - const cleanText = text - .replace(/https?:\/\/\S+/g, "") - .replace(/[^\p{L}\s]/gu, "") - .trim() - .slice(0, 250); - return await detect(cleanText); -} - -// Get the video data from the player -async function getYTVideoData() { - const player = document.querySelector("#movie_player"); - const data = player.getVideoData(); - const response = player.getPlayerResponse(); - const { isLive, isPremiere, title, author } = data; - const { shortDescription: description } = response?.videoDetails ?? {}; - const videoData = { - isLive, - isPremiere, - title, - description, - author, - detectedLanguage: await getLanguage( - player, - response, - title, - description, - author - ), - }; - console.log("VOT Detected language: ", videoData.detectedLanguage); - return videoData; -} - - - -// EXTERNAL MODULE: ./src/yandexRequests.js -var yandexRequests = __webpack_require__("./src/yandexRequests.js"); -// EXTERNAL MODULE: ./src/config/constants.js -var constants = __webpack_require__("./src/config/constants.js"); -// EXTERNAL MODULE: ./src/utils/debug.js -var debug = __webpack_require__("./src/utils/debug.js"); -;// CONCATENATED MODULE: ./src/menu.js - - - -const userlang = navigator.language || navigator.userLanguage; -let lang = userlang.substr(0, 2).toLowerCase(); -if (!(lang in constants/* translations */.Iz)) { - lang = "en"; -} - -function changeBtnColor(n) { - document.querySelector(".translationBtn").style.color = n; -} - -function changeBtnState(newState = "none") { - document.querySelector(".translationBtn").dataset.state = newState; -} - -function changeIconBackground(type = "none") { - let iconBackgroundColor; - switch (type) { - case "error": - iconBackgroundColor = "#7A7A7D"; - break; - case "success": - iconBackgroundColor = "#A36EFF"; - break; - default: - iconBackgroundColor = "#FFFFFF"; - break; - } - - document.querySelector(".translateIcon").style.fill = iconBackgroundColor; -} - -function transformBtn(type = "none", text) { - switch (type) { - case "error": - changeIconBackground(type); - changeBtnColor("#7A7A7D"); - changeBtnState(type); - break; - case "success": - changeIconBackground(type); - changeBtnColor("#A36EFF"); - changeBtnState(type); - break; - default: - changeIconBackground("none"); - changeBtnColor("#FFFFFF"); - changeBtnState("none"); - break; - } - - document.querySelector(".translationBtn").innerText = text; -} - -// Add translation buttton block -function addTranslationBlock(element) { - if (!element || element.querySelector(".translationBlock")) return; - - const block = document.createElement("div"); - block.classList.add("translationBlock"); - block.innerHTML = ` - - - - - - - ${constants/* translations */.Iz[lang].translateVideo} - - - - - - - `; - - element.appendChild(block); - debug/* default */.Z.log("VOT: Added translation button to ", element); -} - -function createTranslationMenu() { - const container = document.createElement("div"); - container.classList.add("translationMenuContent"); - container.innerHTML = ` -

${constants/* translations */.Iz[lang].translationSettings}

-
-
- - - - - - -
- `; - - container.onclick = (event) => event.stopPropagation(); - return container; -} - -// Create checkbox for menu -function createMenuCheckbox(id, valueToCheck, content) { - const checkboxContainer = document.createElement("div"); - const checkbox = document.createElement("input"); - const checkboxLabel = document.createElement("label"); - - checkbox.type = "checkbox"; - checkbox.id = id; - checkbox.checked = Boolean(valueToCheck); - - checkboxLabel.htmlFor = id; - checkboxLabel.innerHTML = content; - - checkboxContainer.classList.add("translationMenuContainer"); - checkboxContainer.appendChild(checkbox); - checkboxContainer.appendChild(checkboxLabel); - - return checkboxContainer; -} - -// Create slider for menu -function createMenuSlider(id, sliderValue, content) { - const sliderContainer = document.createElement("div"); - const slider = document.createElement("input"); - const sliderLabel = document.createElement("label"); - - slider.type = "range"; - slider.id = id; - slider.classList.add("VOTMenuSlider"); - slider.min = 0; - slider.max = 100; - slider.value = sliderValue; - - sliderLabel.htmlFor = id; - sliderLabel.classList.add("translationHeader"); - sliderLabel.innerHTML = content; - - sliderContainer.classList.add("translationMenuContainer"); - sliderContainer.appendChild(sliderLabel); - sliderContainer.appendChild(slider); - - return sliderContainer; -} - -// Create select for menu -function createMenuSelect(id, selectOptions) { - // selectOptions structure: - // [ - // { - // label: string, - // value: string, - // selected: boolean, - // disabled: boolean - // } - // ] - const selectContainer = document.createElement("div"); - const select = document.createElement("select"); - - select.id = id; - select.classList.add("VOTMenuSelect"); - - for (const option of selectOptions) { - const optionElement = document.createElement("option"); - optionElement.innerText = option.label; - optionElement.value = option.value; - if ( - Object.prototype.hasOwnProperty.call(option, "selected") && - option.selected - ) { - optionElement.setAttribute("selected", "selected"); - } - - if (Object.prototype.hasOwnProperty.call(option, "disabled")) { - optionElement.disabled = option.disabled; - } - - select.appendChild(optionElement); - } - - selectContainer.classList.add("translationMenuContainer"); - selectContainer.appendChild(select); - - return selectContainer; -} - - - -;// CONCATENATED MODULE: ./src/utils/utils.js - - - -if (!String.prototype.format) { - // https://stackoverflow.com/questions/610406/javascript-equivalent-to-printf-string-format - // syntax example: "is {0} function".format("format") - String.prototype.format = function () { - // store arguments in an array - var args = arguments; - // use replace to iterate over the string - // select the match and check if the related argument is present - // if yes, replace the match with the argument - return this.replace(/{(\d+)}/g, function (match, index) { - // check if the argument is present - return typeof args[index] != "undefined" ? args[index] : match; - }); - }; -} - -function waitForElm(selector) { - // https://stackoverflow.com/questions/5525071/how-to-wait-until-an-element-exists - return new Promise((resolve) => { - const element = document.querySelector(selector); - if (element) { - return resolve(element); - } - - const observer = new MutationObserver(() => { - const element = document.querySelector(selector); - if (element) { - resolve(element); - observer.disconnect(); - } - }); - - observer.observe(document.body, { - childList: true, - subtree: true, - once: true, - }); - }); -} - -const sleep = (m) => new Promise((r) => setTimeout(r, m)); - -const getVideoId = (service) => { - const url = new URL(window.location.href); - - switch (service) { - case "youtube": - return ( - url.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1] || - url.searchParams.get("v") - ); - case "vk": - if (url.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)) { - return url.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1); - } else if (url.searchParams.get("z")) { - return url.searchParams.get("z").split("/")[0]; - } else if (url.searchParams.get("oid") && url.searchParams.get("id")) { - return `video-${Math.abs( - url.searchParams.get("oid") - )}_${url.searchParams.get("id")}`; - } else { - return false; - } - case "9gag": - case "gag": - return url.pathname.match(/gag\/([^/]+)/)?.[1]; - case "twitch": - if (/^m\.twitch\.tv$/.test(window.location.hostname)) { - const linkUrl = document.head.querySelector('link[rel="canonical"]'); - return ( - linkUrl?.href.match(/videos\/([^/]+)/)?.[0] || url.pathname.slice(1) - ); - } else if (/^player\.twitch\.tv$/.test(window.location.hostname)) { - return `videos/${url.searchParams.get("video")}`; - } else if (/^clips\.twitch\.tv$/.test(window.location.hostname)) { - // get link to twitch channel (ex.: https://www.twitch.tv/xqc) - const channelLink = document.querySelector( - ".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']" - ); - if (!channelLink) { - return false; - } - - const channelName = channelLink.href.replace( - "https://www.twitch.tv/", - "" - ); - return `${channelName}/clip/${url.searchParams.get("clip")}`; - } else if (url.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)) { - return url.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]; - } else { - return url.pathname.match(/(?:videos)\/([^/]+)/)?.[0]; - } - case "tiktok": - return url.pathname.match(/video\/([^/]+)/)?.[1]; - case "vimeo": - return ( - url.pathname.match(/[^/]+\/[^/]+$/)?.[0] || - url.pathname.match(/[^/]+$/)?.[0] - ); - case "xvideos": - return url.pathname.match(/[^/]+\/[^/]+$/)?.[0]; - case "pornhub": - return ( - url.searchParams.get("viewkey") || - url.pathname.match(/embed\/([^/]+)/)?.[1] - ); - case "twitter": - return url.pathname.match(/status\/([^/]+)/)?.[1]; - case "udemy": - return url.pathname; - case "facebook": - return url.pathname; - case "rutube": - return url.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1]; - case "coub": - return url.pathname.match(/view\/([^/]+)/)?.[1]; - case "bilibili.com": - const bvid = url.searchParams.get("bvid"); - if (bvid) { - return bvid; - } else { - let vid = url.pathname.match(/video\/([^/]+)/)?.[1]; - if (vid && url.search && url.searchParams.get("p") !== null) { - vid += `/?p=${url.searchParams.get("p")}`; - } - return vid; - } - case "mail.ru": - if (url.pathname.startsWith("/v/") || url.pathname.startsWith("/mail/")) { - return url.pathname; - } else if (url.pathname.match(/video\/embed\/([^/]+)/)) { - const referer = document.querySelector( - ".b-video-controls__mymail-link" - ); - if (!referer) { - return false; - } - - return referer?.href.split("my.mail.ru")?.[1]; - } - default: - return false; - } -}; - -function secsToStrTime(secs) { - const minutes = Math.floor(secs / 60); - const seconds = Math.floor(secs % 60); - if (minutes >= 60) { - return constants/* translations */.Iz[lang].translationTakeMoreThanHour; - } else if (minutes >= 10 && minutes % 10) { - return constants/* translations */.Iz[lang].translationTakeApproximatelyMinutes.format( - minutes - ); - } else if (minutes == 1 || (minutes == 0 && seconds > 0)) { - return constants/* translations */.Iz[lang].translationTakeAboutMinute; - } else { - return constants/* translations */.Iz[lang].translationTakeApproximatelyMinute.format( - minutes - ); - } -} - - - -// EXTERNAL MODULE: ./src/config/config.js -var config = __webpack_require__("./src/config/config.js"); -;// CONCATENATED MODULE: ./src/config/alternativeUrls.js -// Sites host Invidious. I tested the performance only on invidious.kevin.rocks, youtu.be and inv.vern.cc -const sitesInvidious = [ - "invidious.snopyta.org", - "yewtu.be", - "invidious.kavin.rocks", - "vid.puffyan.us", - "invidious.namazso.eu", - "inv.riverside.rocks", - "yt.artemislena.eu", - "invidious.flokinet.to", - "invidious.esmailelbob.xyz", - "y.com.sb", - "invidious.nerdvpn.de", - "inv.vern.cc", - "invidious.slipfox.xyz", - "invidio.xamh.de", - "invidious.dhusch.de", -]; - -// Sites host Piped. I tested the performance only on piped.video -const sitesPiped = [ - "piped.video", - "piped.tokhmi.xyz", - "piped.moomoo.me", - "piped.syncpundit.io", - "piped.mha.fi", - "watch.whatever.social", - "piped.garudalinux.org", - "efy.piped.pages.dev", - "watch.leptons.xyz", - "piped.lunar.icu", - "yt.dc09.ru", - "piped.mint.lgbt", - "il.ax", - "piped.privacy.com.de", - "piped.esmailelbob.xyz", - "piped.projectsegfau.lt", - "piped.in.projectsegfau.lt", - "piped.us.projectsegfau.lt", - "piped.privacydev.net", - "piped.palveluntarjoaja.eu", - "piped.smnz.de", - "piped.adminforge.de", - "piped.qdi.fi", - "piped.hostux.net", - "piped.chauvet.pro", - "piped.jotoma.de", - "piped.pfcd.me", - "piped.frontendfriendly.xyz", -]; - - - -;// CONCATENATED MODULE: ./src/indexedDB.js - - - -// --- IndexedDB functions start: -const dbVersion = 2; // current db version -const settingsDefault = { - key: "settings", - autoTranslate: 0, - defaultVolume: 100, - showVideoSlider: 0, - syncVolume: 0, - autoSetVolumeYandexStyle: 1, - dontTranslateYourLang: 1, -}; // default settings for db v1 - -const valuesV2 = { - audioProxy: 0, -}; - -function openDB(name) { - return indexedDB.open(name, dbVersion); -} - -async function initDB() { - return new Promise((resolve, reject) => { - function updateVersionProccessor( - transaction, - db, - indexes, - previousIndexes = {} - ) { - // openRequest is transaction object - // indexes is object of strings with default values (used for createIndex) ex. {"name": 0} - // previousIndexes is indexes for previous version - const objectStore = transaction.objectStore("settings"); - - for (const key of Object.keys(indexes)) { - objectStore.createIndex(key, key, { unique: false }); - } - - console.log("VOT: The database has been updated"); - objectStore.transaction.oncomplete = (event) => { - const objectStore = db - .transaction("settings", "readwrite") - .objectStore("settings"); - const request = objectStore.get("settings"); - - request.onerror = (event) => { - console.error( - "VOT: Data could not be retrieved from the Database: ", - event.error - ); - reject(false); - }; - - request.onsuccess = () => { - const data = - request.result || Object.assign(settingsDefault, previousIndexes); // use data from db or reset all data - for (const key in indexes) { - data[key] = indexes[key]; - } - - const requestUpdate = objectStore.put(data); - - requestUpdate.onerror = (event) => { - console.error( - "VOT: Failed to update the Database to new version", - event.error - ); - reject(false); - }; - - requestUpdate.onsuccess = () => { - console.log( - "VOT: Standard settings of the new version have been added to the Database." - ); - resolve(true); - }; - }; - }; - } - - const openRequest = openDB("VOT"); - - openRequest.onerror = () => { - console.error( - `${constants/* translations */.Iz[lang].VOTFailedInitDB}: ${openRequest.error.message}` - ); - reject(false); - }; - - openRequest.onupgradeneeded = (event) => { - const db = openRequest.result; - - db.onerror = () => { - const errorMessage = constants/* translations */.Iz[lang].VOTFailedInitDB; - alert(errorMessage); - console.error(errorMessage, openRequest.error); - reject(false); - }; - - if (event.oldVersion < 1) { - // db not found - const objectStore = db.createObjectStore("settings", { - keyPath: "key", - }); - - // add indexes for 1 version (without key index) - for (const key of Object.keys(settingsDefault).filter( - (k) => k !== "key" - )) { - objectStore.createIndex(key, key, { unique: false }); - } - - console.log("VOT: Database Created"); - - objectStore.transaction.oncomplete = (event) => { - const objectStore = db - .transaction("settings", "readwrite") - .objectStore("settings"); - const request = objectStore.add(settingsDefault); - - request.onsuccess = () => { - console.log( - "VOT: Standard settings added to the Database: ", - request.result - ); - resolve(true); - }; - - request.onerror = () => { - console.log( - "VOT: Error when adding standard settings to the Database: ", - request.error - ); - reject(false); - }; - }; - } - - if (event.oldVersion < 2) { - // db is outdated (db version is 1) - updateVersionProccessor(openRequest.transaction, db, valuesV2); - } - }; - - openRequest.onsuccess = () => { - const db = openRequest.result; - db.onversionchange = () => { - db.close(); - const errorMessage = constants/* translations */.Iz[lang].VOTDBNeedUpdate; - alert(errorMessage); - console.log(errorMessage); - window.location.reload(); - reject(false); - }; - resolve(true); - }; - - openRequest.onblocked = () => { - const db = openRequest.result; - const errorMessage = constants/* translations */.Iz[lang].VOTDisabledForDBUpdating; - console.error(errorMessage, db); - alert(errorMessage); - reject(false); - }; - }); -} - -async function updateDB({ - autoTranslate, - defaultVolume, - showVideoSlider, - syncVolume, - autoSetVolumeYandexStyle, - dontTranslateYourLang, - audioProxy, -}) { - return new Promise((resolve, reject) => { - if ( - typeof autoTranslate === "number" || - typeof defaultVolume === "number" || - typeof showVideoSlider === "number" || - typeof syncVolume === "number" || - typeof autoSetVolumeYandexStyle === "number" || - typeof dontTranslateYourLang === "number" || - typeof audioProxy === "number" - ) { - const openRequest = openDB("VOT"); - - openRequest.onerror = () => { - const errorMessage = constants/* translations */.Iz[lang].VOTFailedWriteToDB; - alert(errorMessage); - console.error(errorMessage, openRequest.error.message); - reject(false); - }; - - openRequest.onupgradeneeded = async () => { - const db = openRequest.result; - db.close(); - await initDB(); - resolve(true); - }; - - openRequest.onsuccess = () => { - const db = openRequest.result; - db.onversionchange = () => { - db.close(); - console.log( - "VOT: The database needs an update, please reload the page if it didn't happen automatically" - ); - window.location.reload(); - reject(false); - }; - - const objectStore = db - .transaction("settings", "readwrite") - .objectStore("settings"); - const request = objectStore.get("settings"); - - request.onerror = (event) => { - console.error( - "VOT: Data could not be retrieved from the Database: ", - event.error - ); - reject(false); - }; - - request.onsuccess = () => { - const data = request.result; - - if (typeof autoTranslate === "number") { - data.autoTranslate = autoTranslate; - } - - if (typeof defaultVolume === "number") { - data.defaultVolume = defaultVolume; - } - - if (typeof showVideoSlider === "number") { - data.showVideoSlider = showVideoSlider; - } - - if (typeof syncVolume === "number") { - data.syncVolume = syncVolume; - } - - if (typeof autoSetVolumeYandexStyle === "number") { - data.autoSetVolumeYandexStyle = autoSetVolumeYandexStyle; - } - - if (typeof dontTranslateYourLang === "number") { - data.dontTranslateYourLang = dontTranslateYourLang; - } - - if (typeof audioProxy === "number") { - data.audioProxy = audioProxy; - } - - const requestUpdate = objectStore.put(data); - - requestUpdate.onerror = (event) => { - console.error( - "VOT: Не удалось обновить данные в Базе Данных: ", - event.error - ); - reject(false); - }; - - requestUpdate.onsuccess = () => { - resolve(true); - }; - }; - }; - - openRequest.onblocked = () => { - const db = openRequest.result; - const errorMessage = constants/* translations */.Iz[lang].VOTDisabledForDBUpdating; - console.error(errorMessage, db); - alert(errorMessage); - reject(false); - }; - } - }); -} - -async function readDB() { - return new Promise((resolve, reject) => { - const openRequest = openDB("VOT"); - - openRequest.onerror = () => { - const errorMessage = constants/* translations */.Iz[lang].VOTFailedReadFromDB; - alert(errorMessage); - console.error(errorMessage, openRequest.error.message); - reject(false); - }; - - openRequest.onupgradeneeded = async () => { - const db = openRequest.result; - db.close(); - await initDB(); - resolve(true); - }; - - openRequest.onsuccess = () => { - const db = openRequest.result; - db.onversionchange = () => { - db.close(); - const errorMessage = constants/* translations */.Iz[lang].VOTDBNeedUpdate; - alert(errorMessage); - console.error(errorMessage); - reject(false); - }; - - const objectStore = db.transaction("settings").objectStore("settings"); - const request = objectStore.get("settings"); - - request.onerror = (event) => { - console.error(constants/* translations */.Iz[lang].VOTFailedReadFromDB, event.error); - console.error(event); - reject(false); - }; - - request.onsuccess = () => { - if (request.result === undefined) { - db.close(); - deleteDB(); - reject(false); - } - const data = request.result; - resolve(data); - }; - }; - - openRequest.onblocked = () => { - const db = openRequest.result; - const errorMessage = constants/* translations */.Iz[lang].VOTDisabledForDBUpdating; - console.error(errorMessage, db); - alert(errorMessage); - reject(false); - }; - }); -} - -function deleteDB() { - indexedDB.deleteDatabase("VOT"); -} - - - -;// CONCATENATED MODULE: ./src/utils/volume.js -// element - audio / video element -function syncVolume(element, sliderVolume, otherSliderVolume, tempVolume) { - let finalValue; - if (sliderVolume > tempVolume) { - // sliderVolume = 100 - // tempVolume = 69 - // volume = 15 - // 100 - 69 = 31 - // 15 + 31 = 46 - final video volume - finalValue = otherSliderVolume + (sliderVolume - tempVolume); - finalValue = finalValue > 100 ? 100 : Math.max(finalValue, 0); - - element.volume = finalValue / 100; - } else if (sliderVolume < tempVolume) { - // sliderVolume = 69 - // tempVolume = 100 - // volume = 15 - // 100 - 69 = 31 - // 15 - 31 = 0 - final video volume - finalValue = otherSliderVolume - (tempVolume - sliderVolume); - finalValue = finalValue > 100 ? 100 : Math.max(finalValue, 0); - - element.volume = finalValue / 100; - } - - return finalValue; -} - - - -// EXTERNAL MODULE: ./src/config/config-cloudflare.js -var config_cloudflare = __webpack_require__("./src/config/config-cloudflare.js"); -;// CONCATENATED MODULE: ./src/config/regexes.js -const regexes = () => { - return { - youtubeRegex: /^(www.|m.)?youtube(-nocookie)?.com$/, - }; -}; - -/* harmony default export */ const config_regexes = (regexes()); - -;// CONCATENATED MODULE: ./src/config/selectors.js -const selectors = () => { - return { - youtubeSelector: ".html5-video-container", - twitchSelector: ".video-ref", - twitchMobileSelector: "main > div > section > div > div > div", - pipedSelector: ".shaka-video-container", - vkSelector: ".videoplayer_media", - twitterSelector: - 'div[data-testid="videoComponent"] > div:nth-child(1) > div', - vimeoSelector: ".player", - gagSelector: ".video-post", - bilibilicomSelector: ".bpx-player-video-wrap", - mailSelector: "#b-video-wrapper", - }; -}; - -/* harmony default export */ const config_selectors = (selectors()); - -;// CONCATENATED MODULE: ./src/index.js - - - - - - - - - - - - - - - -const sitesChromiumBlocked = [...sitesInvidious, ...sitesPiped]; - -// translate properties -let translateFromLang = "en"; // default language of video - -let translateToLang = "ru"; // default language of audio response - -let ytData = ""; - -async function src_main() { - debug/* default */.Z.log("Loading extension..."); - debug/* default */.Z.log(`Selected menu language: ${lang}`); - // test all translations in console - // debug.translations('ru'); - // debug.translations('en'); - // debug.translations('de'); - // debug.translations('zh'); - // debug.translations('es'); - // debug.translations('fr'); - // debug.translations('it'); - - const rvt = await Promise.resolve(/* import() */).then(__webpack_require__.bind(__webpack_require__, "./src/rvt-cloudflare.js")); - - const requestVideoTranslation = rvt.default; - - debug/* default */.Z.log("Inited requestVideoTranslation..."); - - if ( - false - ) {} - - debug/* default */.Z.log("Extension compatibility passed..."); - - let timer; - const audio = new Audio(); - let opacityRatio = 0.9; - let openedMenu = false; - - if (true) { - var translationPanding = false; - } - - function logout(n) { - if (openedMenu) return; - - document.querySelector(".translationBlock").style.opacity = n; - } - - function resetTimer() { - clearTimeout(timer); - logout(1); - timer = setTimeout(() => { - logout(0); - }, 2000); - } - - function changeOpacityOnEvent(event, timer, opacityRatio) { - clearTimeout(timer); - logout(opacityRatio); - event.stopPropagation(); - } - - const deleteAudioSrc = () => { - audio.src = ""; - audio.removeAttribute("src"); - }; - - // Add menu container - function addTranslationMenu(element) { - if (element.querySelector(".translationMenuContent")) return; - - const container = createTranslationMenu(); - element.appendChild(container); - - // click to translation menu icon - document - .querySelector(".translationMenu") - ?.addEventListener("click", (event) => { - event.stopPropagation(); - const content = document.querySelector(".translationMenuContent"); - content.style.display = openedMenu ? "none" : "block"; - content.style.opacity = opacityRatio; - openedMenu = !openedMenu; - }); - - document - .querySelector(".translationDropDB") - .addEventListener("click", (event) => { - event.stopPropagation(); - deleteDB(); - location.reload(); - }); - - debug/* default */.Z.log("VOT: Added translation menu to ", element); - } - - function translateVideo(url, unknown1, requestLang, responseLang, callback) { - debug/* default */.Z.log( - `Translate video (url: ${url}, unknown1: ${unknown1}, requestLang: ${requestLang}, responseLang: ${responseLang})` - ); - - if ( true && translationPanding) { - debug/* default */.Z.log("translationPanding return"); - return; - } - - translationPanding = true; - - requestVideoTranslation( - url, - unknown1, - requestLang, - responseLang, - (success, response) => { - translationPanding = false; - - debug/* default */.Z.log("[exec callback] Requesting video translation"); - if (!success) { - callback(false, constants/* translations */.Iz[lang].requestTranslationFailed); - return; - } - - const translateResponse = yandexRequests/* yandexRequests */.G.decodeResponse(response); - console.log("VOT Response: ", translateResponse); - - switch (translateResponse.status) { - case 0: - callback(false, translateResponse.message); - break; - case 1: - callback( - !!translateResponse.url, - translateResponse.url || constants/* translations */.Iz[lang].audioNotReceived - ); - break; - case 2: - callback( - false, - translateResponse.remainingTime - ? secsToStrTime(translateResponse.remainingTime) - : constants/* translations */.Iz[lang].translationTakeFewMinutes - ); - break; - case 3: - /* - Иногда, в ответе приходит статус код 3, но видео всё, так же, ожидает перевода. В конечном итоге, это занимает слишком много времени, - как-будто сервер не понимает, что данное видео уже недавно было переведено и заместо возвращения готовой ссылки на перевод начинает переводить видео заново при чём у него это получается за очень длительное время - */ - callback(false, constants/* translations */.Iz[lang].videoBeingTranslated); - break; - } - } - ); - } - - async function translateProccessor(videoContainer, siteHostname, siteEvent) { - debug/* default */.Z.log("[translateProccessor] execute on element: ", videoContainer); - - let video; - let autoRetry; - let volumeOnStart; - let tempOriginalVolume; - let tempVolume; - let dbAutoTranslate; - let dbDefaultVolume; - let dbShowVideoSlider; - let dbAutoSetVolumeYandexStyle; - let dontTranslateYourLang; - let dbSyncVolume; - let dbAudioProxy; // cf version only - let firstPlay = true; - let isDBInited; - - debug/* default */.Z.log("videoContainer", videoContainer); - - video = - siteHostname === "vimeo" - ? videoContainer.querySelector( - ".vp-video-wrapper > .vp-video > .vp-telecine > video" - ) - : videoContainer.querySelector("video"); - - debug/* default */.Z.log("video", video); - - let videoData = await getVideoData(); - console.log("VOT Video Data: ", videoData); - - const container = - siteHostname === "pornhub" && - window.location.pathname.includes("view_video.php") - ? document.querySelector(".original.mainPlayerDiv") - : siteHostname === "pornhub" && - window.location.pathname.includes("embed/") - ? document.querySelector("body") - : window.location.hostname.includes("m.youtube.com") - ? document.querySelector("#player-control-container") - : videoContainer; - - addTranslationBlock(container); - addTranslationMenu(container); - - try { - isDBInited = await initDB(); - } catch (err) { - console.error( - "[VOT] Failed to initialize database settings. All changes made will not be saved", - err - ); - } - - const menuOptions = document.querySelector(".translationMenuOptions"); - if (menuOptions && !menuOptions.querySelector("#VOTTranslateFromLang")) { - const selectFromLangOptions = [ - { - label: constants/* translations */.Iz[lang].videoLanguage, - value: "default", - disabled: true, - }, - ...Object.entries(constants/* availableLangs */.tW).map(([key, value]) => ({ - label: constants/* translations */.Iz[lang][value], - value: key, - selected: videoData.detectedLanguage === key, - })), - ]; - - const selectToLangOptions = [ - { - label: constants/* translations */.Iz[lang].translationLanguage, - value: "default", - disabled: true, - }, - ...Object.entries(constants/* availableLangs */.tW).map(([key, value]) => ({ - label: constants/* translations */.Iz[lang][value], - value: key, - selected: videoData.responseLanguage === key, - })), - ]; - - const selectFromLang = createMenuSelect( - "VOTTranslateFromLang", - selectFromLangOptions - ); - - const selectToLang = createMenuSelect( - "VOTTranslateToLang", - selectToLangOptions - ).firstElementChild; - - selectFromLang.id = "VOTSelectLanguages"; - selectFromLang.innerHTML += ` - - - - `; - - selectFromLang.appendChild(selectToLang); - menuOptions.appendChild(selectFromLang); - - menuOptions - .querySelector("#VOTTranslateFromLang") - .addEventListener("change", async (event) => { - debug/* default */.Z.log("[onchange] select from language", event.target.value); - videoData = await setDetectedLangauge(videoData, event.target.value); - }); - - menuOptions - .querySelector("#VOTTranslateToLang") - .addEventListener("change", async (event) => { - debug/* default */.Z.log("[onchange] select to language", event.target.value); - videoData = await setResponseLangauge(videoData, event.target.value); - }); - } - - if (isDBInited) { - const dbData = await readDB(); - if (dbData) { - dbAutoTranslate = dbData.autoTranslate; - dbDefaultVolume = dbData.defaultVolume; - dbShowVideoSlider = dbData.showVideoSlider; - dbAutoSetVolumeYandexStyle = dbData.autoSetVolumeYandexStyle; - dontTranslateYourLang = dbData.dontTranslateYourLang; - dbAudioProxy = dbData.audioProxy; // cf version only - dbSyncVolume = dbData.syncVolume; // youtube only - - debug/* default */.Z.log("[db] data from db: ", dbData); - - if ( - dbAutoTranslate !== undefined && - menuOptions && - !menuOptions.querySelector("#VOTAutoTranslate") - ) { - const checkbox = createMenuCheckbox( - "VOTAutoTranslate", - dbAutoTranslate, - constants/* translations */.Iz[lang].VOTAutoTranslate + - (siteHostname === "vk" || - window.location.hostname.includes("m.twitch.tv") - ? ` (${constants/* translations */.Iz[lang].recommended})` - : "") - ); - - checkbox.querySelector("#VOTAutoTranslate").onclick = async ( - event - ) => { - event.stopPropagation(); - const value = Number(event.target.checked); - await updateDB({ autoTranslate: value }); - dbAutoTranslate = value; - debug/* default */.Z.log( - "autoTranslate value changed. New value: ", - dbAutoTranslate - ); - }; - - menuOptions.appendChild(checkbox); - } - - if ( - window.location.hostname.includes("youtube.com") && - dontTranslateYourLang !== undefined && - menuOptions && - !menuOptions.querySelector("#VOTDontTranslateYourLang") - ) { - const checkbox = createMenuCheckbox( - "VOTDontTranslateYourLang", - dontTranslateYourLang, - constants/* translations */.Iz[lang].VOTDontTranslateYourLang - ); - - checkbox.querySelector("#VOTDontTranslateYourLang").onclick = async ( - event - ) => { - event.stopPropagation(); - const value = Number(event.target.checked); - await updateDB({ dontTranslateYourLang: value }); - dontTranslateYourLang = value; - debug/* default */.Z.log( - "dontTranslateYourLang value changed. New value: ", - dontTranslateYourLang - ); - }; - - menuOptions.appendChild(checkbox); - } - - if ( - dbAutoSetVolumeYandexStyle !== undefined && - menuOptions && - !menuOptions.querySelector("#VOTAutoSetVolume") - ) { - const checkbox = createMenuCheckbox( - "VOTAutoSetVolume", - dbAutoSetVolumeYandexStyle, - constants/* translations */.Iz[lang].VOTAutoSetVolume + `${config/* autoVolume */.IM * 100}%` - ); - - checkbox.querySelector("#VOTAutoSetVolume").onclick = async ( - event - ) => { - event.stopPropagation(); - const value = Number(event.target.checked); - await updateDB({ autoSetVolumeYandexStyle: value }); - dbAutoSetVolumeYandexStyle = value; - debug/* default */.Z.log( - "autoSetVolumeYandexStyle value changed. New value: ", - dbAutoSetVolumeYandexStyle - ); - }; - - menuOptions.appendChild(checkbox); - } - - if ( - dbShowVideoSlider !== undefined && - menuOptions && - !menuOptions.querySelector("#VOTShowVideoSlider") - ) { - const checkbox = createMenuCheckbox( - "VOTShowVideoSlider", - dbShowVideoSlider, - constants/* translations */.Iz[lang].VOTShowVideoSlider - ); - - checkbox.querySelector("#VOTShowVideoSlider").onclick = async ( - event - ) => { - event.stopPropagation(); - const value = Number(event.target.checked); - await updateDB({ showVideoSlider: value }); - dbShowVideoSlider = value; - debug/* default */.Z.log( - "showVideoSlider value changed. New value: ", - dbShowVideoSlider - ); - if ( - dbShowVideoSlider === 1 && - document.querySelector(".translationBtn").dataset.state === - "success" - ) { - addVideoSlider(); - } else { - document.querySelector("#VOTVideoSlider")?.parentElement.remove(); - } - }; - - menuOptions.appendChild(checkbox); - } - - if ( - window.location.hostname.includes("youtube.com") && - !window.location.hostname.includes("m.youtube.com") && - dbSyncVolume !== undefined && - menuOptions && - !menuOptions.querySelector("#VOTSyncVolume") - ) { - const checkbox = createMenuCheckbox( - "VOTSyncVolume", - dbSyncVolume, - constants/* translations */.Iz[lang].VOTSyncVolume - ); - - checkbox.querySelector("#VOTSyncVolume").onclick = async (event) => { - event.stopPropagation(); - const value = Number(event.target.checked); - await updateDB({ syncVolume: value }); - dbSyncVolume = value; - debug/* default */.Z.log("syncVolume value changed. New value: ", dbSyncVolume); - }; - - menuOptions.appendChild(checkbox); - } - - // cf version only - if ( - true && - dbAudioProxy !== undefined && - menuOptions && - !menuOptions.querySelector("#VOTAudioProxy") - ) { - const checkbox = createMenuCheckbox( - "VOTAudioProxy", - dbAudioProxy, - constants/* translations */.Iz[lang].VOTAudioProxy - ); - - checkbox.querySelector("#VOTAudioProxy").onclick = async (event) => { - event.stopPropagation(); - const value = Number(event.target.checked); - await updateDB({ audioProxy: value }); - dbAudioProxy = value; - debug/* default */.Z.log("audioProxy value changed. New value: ", dbAudioProxy); - }; - - menuOptions.appendChild(checkbox); - } - } - } - - transformBtn("none", constants/* translations */.Iz[lang].translateVideo); - - if ( - window.location.hostname.includes("youtube.com") && - !window.location.hostname.includes("m.youtube.com") - ) { - const syncVolumeObserver = new MutationObserver(async function ( - mutations - ) { - mutations.forEach(async function (mutation) { - if ( - mutation.type === "attributes" && - mutation.attributeName === "aria-valuenow" && - document.querySelector("#VOTVideoSlider") - ) { - syncVideoVolumeSlider(); - } - }); - }); - - syncVolumeObserver.observe(document.querySelector(".ytp-volume-panel"), { - attributes: true, - childList: false, - subtree: true, - attributeOldValue: true, - }); - } - - function setSelectMenuValues(from, to = lang) { - if (!document.querySelector("#VOTSelectLanguages")) { - return; - } - console.log(`Set translation from ${from} to ${to}`); - document.querySelector("#VOTTranslateFromLang").value = from; - document.querySelector("#VOTTranslateToLang").value = to; - } - - // data - ytData or VideoData - async function setDetectedLangauge(data, videolang) { - switch (videolang) { - case "en": - data.detectedLanguage = videolang; - data.responseLanguage = lang; - break; - case "ru": - data.detectedLanguage = videolang; - data.responseLanguage = lang; - if (lang == "ru") data.responseLanguage = "en"; - break; - default: - if (!Object.keys(constants/* availableLangs */.tW).includes(videolang)) { - return setDetectedLangauge(data, "en"); - } - - data.detectedLanguage = videolang; - } - - setSelectMenuValues(data.detectedLanguage, data.responseLanguage); - - return data; - } - - // data - ytData or VideoData - async function setResponseLangauge(data, videolang) { - switch (videolang) { - case "en": - data.responseLanguage = videolang; - data.detectedLanguage = "ru"; - break; - default: - if (!Object.keys(constants/* availableLangs */.tW).includes(videolang)) { - return setResponseLangauge(data, "ru"); - } - - if (data.detectedLanguage && data.responseLanguage === lang) { - data.detectedLanguage = "en"; - } - - data.responseLanguage = videolang; - } - - setSelectMenuValues(data.detectedLanguage, data.responseLanguage); - - return data; - } - - function stopTraslate() { - // Default actions on stop translate - audio.pause(); - video.removeEventListener(".translate", stopTraslate, false); - deleteAudioSrc(); - document.querySelector("#VOTVideoSlider")?.parentElement.remove(); - document.querySelector("#VOTTranslationSlider")?.parentElement.remove(); - const downloadBtn = document.querySelector(".translationDownload"); - downloadBtn.href = ""; - downloadBtn.style.display = "none"; - transformBtn("none", constants/* translations */.Iz[lang].translateVideo); - if (volumeOnStart) { - video.volume = volumeOnStart; - } - } - - function syncVideoVolumeSlider() { - // Sync volume slider with original video (youtube only) - const newSlidersVolume = document - .querySelector(".ytp-volume-panel") - .getAttribute("aria-valuenow"); - - const videoSlider = document.querySelector("#VOTVideoSlider"); - - if (!videoSlider) { - return; - } - videoSlider.value = newSlidersVolume; - - const videoVolumeLabel = document.querySelector("#VOTVideoVolume"); - - if (videoVolumeLabel) { - videoVolumeLabel.innerText = `${newSlidersVolume}%`; - } - - if (dbSyncVolume === 1) { - tempOriginalVolume = Number(newSlidersVolume); - } - } - - async function getVideoData() { - const videoData = {}; - - videoData.duration = video?.duration || 0; - - videoData.videoId = getVideoId(siteHostname); - - videoData.detectedLanguage = translateFromLang; - - videoData.responseLanguage = translateToLang; - - if (window.location.hostname.includes("youtube.com")) { - ytData = await getYTVideoData(); - ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); - videoData.detectedLanguage = ytData.detectedLanguage; - videoData.responseLanguage = ytData.responseLanguage; - } else if ( - window.location.hostname.includes("rutube") || - window.location.hostname.includes("my.mail.ru") - ) { - videoData.detectedLanguage = "ru"; - videoData.responseLanguage = "en"; - } else if (window.location.hostname.includes("bilibili.com")) { - videoData.detectedLanguage = "zh"; - } - - return videoData; - } - - const lipSync = (mode = false) => { - debug/* default */.Z.log("lipsync video", video); - if (!video) { - return; - } - audio.currentTime = video.currentTime; - audio.playbackRate = video.playbackRate; - - if (!mode) { - debug/* default */.Z.log("lipsync mode is not set"); - return; - } - - if (mode === "play") { - debug/* default */.Z.log("lipsync mode is play"); - const audioPromise = audio.play(); - if (audioPromise !== undefined) { - audioPromise.catch((e) => { - console.error(e); - if (e.name === "NotAllowedError") { - const errorMessage = constants/* translations */.Iz[lang].grantPermissionToAutoPlay; - transformBtn("error", errorMessage); - throw `VOT: ${errorMessage}`; - } else if (e.name === "NotSupportedError") { - const errorMessage = sitesChromiumBlocked.includes( - window.location.hostname - ) - ? constants/* translations */.Iz[lang].neededAdditionalExtension - : constants/* translations */.Iz[lang].audioFormatNotSupported; - transformBtn("error", errorMessage); - throw `VOT: ${errorMessage}`; - } - }); - } - return; - } - if (mode === "pause" || "stop" || 0 || 0) { - debug/* default */.Z.log(`lipsync mode is ${mode}`); - audio.pause(); - } - if (mode === "playing") { - debug/* default */.Z.log("lipsync mode is playing"); - audio.play(); - } - }; - - function addVideoSlider() { - if ( - dbShowVideoSlider !== 1 || - document.querySelector("#VOTVideoSlider") || - document.querySelector(".translationBtn").dataset.state !== "success" - ) { - return; - } - - const newVolume = - window.location.hostname.includes("youtube.com") && - !dbAutoSetVolumeYandexStyle - ? document - .querySelector(".ytp-volume-panel") - ?.getAttribute("aria-valuenow") - : Math.round(video.volume * 100); - tempOriginalVolume = newVolume; - - const slider = createMenuSlider( - "VOTVideoSlider", - newVolume, - `${constants/* translations */.Iz[lang].VOTVolume}: ${newVolume}%` - ); - - slider.querySelector("#VOTVideoSlider").oninput = (event) => { - const { value } = event.target; - video.volume = value / 100; - slider.querySelector("#VOTOriginalVolume").innerText = `${value}%`; - - if (dbSyncVolume !== 1) { - return; - } - - // Sync translation volume slider with video volume slider - const translateVolumeSlider = document.querySelector( - "#VOTTranslationSlider" - ); - - if (!translateVolumeSlider) { - return; - } - const translateVolume = Number(translateVolumeSlider.value); - const finalValue = syncVolume( - audio, - value, - translateVolume, - tempOriginalVolume - ); - - translateVolumeSlider.value = finalValue; - - const translateVolumeLabel = document.querySelector( - "#VOTTranslationVolume" - ); - - if (translateVolumeLabel) { - translateVolumeLabel.innerText = `${finalValue}%`; - } - - tempVolume = finalValue; - tempOriginalVolume = value; - }; - - const menuOptions = document.querySelector(".translationMenuOptions"); - menuOptions.appendChild(slider); - } - - function addTranslationSlider() { - // Return early if slider already exists or translation is not successful - if ( - document.querySelector("#VOTTranslationSlider") || - document.querySelector(".translationBtn").dataset.state !== "success" - ) { - return; - } - - // Use dbDefaultVolume or 100 as the default translation volume - const defaultTranslateVolume = - typeof dbDefaultVolume === "number" ? dbDefaultVolume : 100; - tempOriginalVolume = defaultTranslateVolume; - - // Create a slider element with the default volume and label - const slider = createMenuSlider( - "VOTTranslationSlider", - defaultTranslateVolume, - `${constants/* translations */.Iz[lang].VOTVolumeTranslation}: ${defaultTranslateVolume}%` - ); - - // Add an input event listener to the slider - slider.querySelector("#VOTTranslationSlider").oninput = async ({ - target: { value }, - }) => { - // Set the audio volume to the slider value - audio.volume = value / 100; - - // Update the volume label - document.querySelector("#VOTTranslationVolume").innerText = `${value}%`; - - // Update the database with the new volume value - await updateDB({ defaultVolume: Number(value) }); - dbDefaultVolume = Number(value); - - // Sync translation volume with video volume if dbSyncVolume is 1 - if (dbSyncVolume === 1) { - syncTranslationWithVideo(value); - } - }; - - // Append the slider to the menu options - const menuOptions = document.querySelector(".translationMenuOptions"); - menuOptions.appendChild(slider); - } - - // A helper function to sync translation volume with video volume - function syncTranslationWithVideo(translationValue) { - // Get the video volume slider element - const videoVolumeSlider = document.querySelector("#VOTVideoSlider"); - - if (!videoVolumeSlider) { - return; - } - // Get the video volume value - const videoVolume = Number(videoVolumeSlider.value); - - // Calculate the synced video volume based on the translation volume - const finalValue = syncVolume( - video, - translationValue, - videoVolume, - tempVolume - ); - - // Set the video volume slider value to the synced value - videoVolumeSlider.value = finalValue; - - // Update the video volume label - const videoVolumeLabel = document.querySelector("#VOTOriginalVolume"); - if (videoVolumeLabel) videoVolumeLabel.innerText = `${finalValue}%`; - - // Update the temp variables for future syncing - tempOriginalVolume = finalValue; - tempVolume = translationValue; - } - - async function videoValidator() { - if (window.location.hostname.includes("youtube.com")) { - ytData = setDetectedLangauge(ytData, ytData.detectedLanguage); - debug/* default */.Z.log("VideoValidator videoData: ", videoData); - if (dontTranslateYourLang === 1 && ytData.detectedLanguage === lang) { - firstPlay = false; - throw constants/* translations */.Iz[lang].VOTDisableFromYourLang; - } - - if (ytData.isLive) { - throw constants/* translations */.Iz[lang].VOTLiveNotSupported; - } - - if (ytData.isPremiere) { - throw constants/* translations */.Iz[lang].VOTPremiere; - } - if (videoData.duration > 14_400) { - throw constants/* translations */.Iz[lang].VOTVideoIsTooLong; - } - } - return true; - } - - const translateExecutor = async (VIDEO_ID) => { - debug/* default */.Z.log("Run videoValidator"); - await videoValidator(); - debug/* default */.Z.log("Run translateFunc"); - await translateFunc( - VIDEO_ID, - videoData.detectedLanguage, - videoData.responseLanguage - ); - }; - - // Define a function to handle common events - function handleVideoEvent(event) { - debug/* default */.Z.log(`video ${event.type}`); - lipSync(event.type); - } - - // Define a function to stop translation and clean up - function stopTranslation() { - stopTraslate(); - syncVideoVolumeSlider(); - } - - // Define a function to translate a video and handle the callback - function translateFunc(VIDEO_ID, requestLang, responseLang) { - const videoURL = `${constants/* siteTranslates */.g$[siteHostname]}${VIDEO_ID}`; - translateVideo( - videoURL, - constants/* translateFuncParam */.ey, - requestLang, - responseLang, - async (success, urlOrError) => { - debug/* default */.Z.log("[exec callback] translateVideo"); - if (getVideoId(siteHostname) !== VIDEO_ID) return; - if (!success) { - transformBtn("error", urlOrError); - // if the error line contains information that the translation is being performed, then we wait - if (urlOrError.includes(constants/* translations */.Iz[lang].translationTake)) { - clearTimeout(autoRetry); - autoRetry = setTimeout( - () => translateFunc(VIDEO_ID, requestLang, responseLang), - 60_000 - ); - } - throw urlOrError; - } - - audio.src = urlOrError; - - // cf version only - if ( - true && - dbAudioProxy === 1 && - urlOrError.startsWith("https://") - ) { - const audioPath = urlOrError.replace( - "https://vtrans.s3-private.mds.yandex.net/tts/prod/", - "" - ); - const proxiedAudioUrl = `https://${config_cloudflare/* workerHost */.i}/video-translation/audio-proxy/${audioPath}`; - console.log(`VOT Audio proxied via ${proxiedAudioUrl}`); - audio.src = proxiedAudioUrl; - } - - volumeOnStart = video?.volume; - if (typeof dbDefaultVolume === "number") { - audio.volume = dbDefaultVolume / 100; - } - if ( - typeof dbAutoSetVolumeYandexStyle === "number" && - dbAutoSetVolumeYandexStyle - ) { - video.volume = config/* autoVolume */.IM; - } - - switch (siteHostname) { - case "twitter": - document - .querySelector('div[data-testid="app-bar-back"][role="button"]') - .addEventListener("click", stopTranslation); - break; - case "invidious": - case "piped": - break; - default: - if (siteEvent !== null) { - document.body.addEventListener(siteEvent, stopTranslation); - } - break; - } - - const siteHostnames = [ - "twitch", - "vimeo", - "facebook", - "rutube", - "twitter", - "bilibili.com", - "mail.ru", - ]; - for (let i = 0; i < siteHostnames.length; i++) { - if (siteHostname === siteHostnames[i]) { - const mutationObserver = new MutationObserver( - async (mutations) => { - mutations.forEach(async (mutation) => { - if ( - mutation.type === "attributes" && - mutation.attributeName === "src" && - mutation.target === video && - mutation.target.src !== "" - ) { - stopTranslation(); - firstPlay = true; - } - }); - } - ); - mutationObserver.observe(videoContainer, { - attributes: true, - childList: false, - subtree: true, - attributeOldValue: true, - }); - break; - } - } - - if (video && !video.paused) lipSync("play"); - const videos = document.querySelectorAll("video"); - const events = [ - "playing", - "ratechange", - "play", - "abort", - "waiting", - "pause", - ]; - videos.forEach((v) => - events.forEach((e) => v.addEventListener(e, handleVideoEvent)) - ); - transformBtn("success", constants/* translations */.Iz[lang].disableTranslate); - addVideoSlider(); - addTranslationSlider(); - - const VOTVideoSlider = document.querySelector("#VOTVideoSlider"); - if (VOTVideoSlider) VOTVideoSlider.value = config/* autoVolume */.IM * 100; - - const VOTOriginalVolume = - document.querySelector("#VOTOriginalVolume"); - if (VOTOriginalVolume) { - VOTOriginalVolume.innerText = `${config/* autoVolume */.IM * 100}%`; - } - - const downloadBtn = document.querySelector(".translationDownload"); - downloadBtn.href = urlOrError; - downloadBtn.style.display = "initial"; - } - ); - } - - document.addEventListener("click", (event) => { - const block = document.querySelector(".translationBlock"); - const menuContainer = document.querySelector(".translationMenuContent"); - const isBlock = - block || event.target === block ? block.contains(event.target) : false; - const isContent = - menuContainer || event.target === menuContainer - ? menuContainer.contains(event.target) - : false; - const isVideo = - videoContainer || event.target === videoContainer - ? videoContainer.contains(event.target) - : false; - - debug/* default */.Z.log(`[document click] ${isBlock} ${isContent} ${isVideo}`); - if (!(!isBlock && !isContent)) return; - if (!isVideo) logout(0); - - menuContainer.style.display = "none"; - openedMenu = false; - }); - - const addEventListeners = (element, events, handler) => { - events.forEach((event) => element.addEventListener(event, handler)); - }; - - if (siteHostname === "pornhub") { - if (window.location.pathname.includes("view_video.php")) { - const videoElement = document.querySelector( - ".original.mainPlayerDiv > video-element > div" - ); - addEventListeners(videoElement, ["mousemove", "mouseout"], resetTimer); - } else if (window.location.pathname.includes("embed/")) { - const playerElement = document.querySelector("#player"); - addEventListeners(playerElement, ["mousemove", "mouseout"], resetTimer); - } - } else if (siteHostname === "twitter") { - const videoPlayerElement = document.querySelector( - 'div[data-testid="videoPlayer"' - ); - addEventListeners( - videoPlayerElement, - ["mousemove", "mouseout"], - resetTimer - ); - } else { - addEventListeners(videoContainer, ["mousemove", "mouseout"], resetTimer); - } - - document - .querySelector(".translationBlock") - .addEventListener("mousemove", (event) => - changeOpacityOnEvent(event, timer, opacityRatio) - ); - document - .querySelector(".translationMenuContent") - .addEventListener("mousemove", (event) => - changeOpacityOnEvent(event, timer, opacityRatio) - ); - - document.addEventListener("touchstart", (event) => - changeOpacityOnEvent(event, timer, opacityRatio) - ); - document.addEventListener("touchmove", (event) => - changeOpacityOnEvent(event, timer, opacityRatio) - ); - document.addEventListener("touchend", (event) => - changeOpacityOnEvent(event, timer, opacityRatio) - ); - - document - .querySelector(".translationBtn") - .addEventListener("click", async (event) => { - debug/* default */.Z.log("[click translationBtn] before all functions & methods"); - event.stopPropagation(); - event.stopImmediatePropagation(); - - // check if the audio source is not empty - if (audio.src) { - debug/* default */.Z.log("[click translationBtn] audio.src is not empty"); - stopTraslate(); - return; - } - - try { - debug/* default */.Z.log("[click translationBtn] trying execute translation"); - const VIDEO_ID = getVideoId(siteHostname); - - if (!VIDEO_ID) { - throw constants/* translations */.Iz[lang].VOTNoVideoIDFound; - } - - await translateExecutor(VIDEO_ID); - } catch (err) { - transformBtn("error", String(err).substring(4, err.length)); - console.error(err); - } - }); - - video.addEventListener("progress", async (event) => { - event.stopPropagation(); - - if (!(firstPlay && dbAutoTranslate === 1)) { - return; - } - const VIDEO_ID = getVideoId(siteHostname); - - if (!VIDEO_ID) { - throw constants/* translations */.Iz[lang].VOTNoVideoIDFound; - } - - try { - await translateExecutor(VIDEO_ID); - firstPlay = false; - } catch (err) { - transformBtn("error", String(err).substring(4, err.length)); - firstPlay = false; - } - }); - } - - async function initWebsite() { - debug/* default */.Z.log("Runned initWebsite function"); - if (config_regexes.youtubeRegex.test(window.location.hostname)) { - if (window.location.pathname.includes("embed")) { - const videoContainer = document.querySelector(".html5-video-container"); - await translateProccessor(videoContainer, "youtube", null); - return; - } - - debug/* default */.Z.log("[initWebsite] Found a match with youtube hostname"); - const ytPageEnter = () => { - const videoContainer = document.querySelector( - config_selectors.youtubeSelector - ); - if (videoContainer) { - debug/* default */.Z.log("[exec] translateProccessor youtube on page enter"); - translateProccessor(videoContainer, "youtube", "yt-translate-stop"); - } else { - if (!ytplayer || !ytplayer.config) { - debug/* default */.Z.log("[exec] ytplayer is null"); - return; - } - ytplayer.config.args.jsapicallback = () => { - debug/* default */.Z.log( - "[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)" - ); - translateProccessor(videoContainer, "youtube", "yt-translate-stop"); - }; - } - }; - - document.addEventListener("spfdone", ytPageEnter); - document.addEventListener("yt-navigate-finish", ytPageEnter); - - const ytPageLeave = () => { - document.body.dispatchEvent(new Event("yt-translate-stop")); - }; - - document.addEventListener("spfrequest", ytPageLeave); - document.addEventListener("yt-navigate-start", ytPageLeave); - - if (window.location.hostname.includes("m.youtube.com")) { - let ytmobile = await waitForElm("#player"); - if (ytmobile) { - await sleep(1000); - await translateProccessor(ytmobile, "youtube", "yt-translate-stop"); - - const mutationObserver = new MutationObserver(async (mutations) => { - for (const mutation of mutations) { - if ( - mutation.type === "attributes" && - mutation.attributeName === "src" - ) { - ytmobile = await waitForElm("#player"); - await sleep(1000); - await translateProccessor( - ytmobile, - "youtube", - "yt-translate-stop" - ); - } - } - }); - - mutationObserver.observe(ytmobile, { - attributes: true, - childList: true, - subtree: true, - attributeOldValue: true, - }); - } - const ytPageLeave = () => { - document.body.dispatchEvent(new Event("yt-translate-stop")); - }; - document.addEventListener("spfdone", ytPageLeave); - document.addEventListener("yt-navigate-finish", ytPageLeave); - document.addEventListener("spfrequest", ytPageLeave); - document.addEventListener("yt-navigate-start", ytPageLeave); - } - return; - } - if (window.location.hostname.includes("twitch.tv")) { - debug/* default */.Z.log("[initWebsite] Found a match with twitch.tv"); - if ( - window.location.hostname.includes("m.twitch.tv") && - (window.location.pathname.includes("/videos/") || - window.location.pathname.includes("/clip/")) - ) { - debug/* default */.Z.log("[initWebsite] Matched Twitch Mobile"); - const el = await waitForElm(config_selectors.twitchMobileSelector); - if (el) { - await sleep(200); - const twitchMobileSelector = document.querySelector( - config_selectors.twitchMobileSelector - ); - await translateProccessor(twitchMobileSelector, "twitch", null); - - const mutationObserver = new MutationObserver(async (mutations) => { - for (const mutation of mutations) { - if ( - mutation.type === "attributes" && - mutation.attributeName === "src" && - mutation.target === twitchMobileSelector?.querySelector("video") - ) { - await sleep(1000); - await translateProccessor(twitchMobileSelector, "twitch", null); - } - } - }); - - mutationObserver.observe(twitchMobileSelector, { - attributes: true, - childList: true, - subtree: true, - attributeOldValue: true, - }); - } - } else if ( - window.location.hostname.includes("player.twitch.tv") || - window.location.hostname.includes("clips.twitch.tv") || - window.location.pathname.includes("/videos/") || - window.location.pathname.includes("/clip/") - ) { - debug/* default */.Z.log("[initWebsite] Matched Twitch Desktop"); - const el = await waitForElm(config_selectors.twitchSelector); - if (el) { - await sleep(200); - await translateProccessor(el, "twitch", null); - } - } - debug/* default */.Z.log("[initWebsite] Exit function in the twitch section"); - return; - } - if (window.location.hostname.includes("xvideos.com")) { - debug/* default */.Z.log("[entered] xvideos"); - await sleep(1000); - await translateProccessor( - document.querySelector(".video-bg-pic"), - "xvideos", - null - ); - return; - } - if (window.location.hostname.includes("pornhub.com")) { - debug/* default */.Z.log("[entered] pornhub"); - await sleep(1000); - await translateProccessor( - document.querySelector(".mgp_videoWrapper"), - "pornhub", - null - ); - return; - } - if (sitesInvidious.includes(window.location.hostname)) { - // Need an additional extension to work in chrome-like browsers - debug/* default */.Z.log("[entered] invidious"); - await translateProccessor( - document.querySelector("#player"), - "youtube", - null - ); - } else if (sitesPiped.includes(window.location.hostname)) { - // Need an additional extension to work in chrome-like browsers - debug/* default */.Z.log("[entered] piped"); - const el = await waitForElm(config_selectors.pipedSelector); - if (el) { - let videoIDNew; - let videoID = getVideoId("youtube"); - await translateProccessor(el, "youtube", "piped"); - setInterval(async () => { - videoIDNew = getVideoId("youtube"); - if (videoID !== videoIDNew) { - if (videoIDNew) { - await translateProccessor( - document.querySelector(config_selectors.pipedSelector), - "youtube", - "piped" - ); - } - videoID = videoIDNew; - } - }, 3000); - } - } else if (/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)) { - debug/* default */.Z.log("[entered] vk.com"); - const el = await waitForElm(config_selectors.vkSelector); - if (el) { - await translateProccessor( - document.querySelector(config_selectors.vkSelector), - "vk", - null - ); - let videoIDVKNew; - let videoIDVK = getVideoId("vk"); - setInterval(async () => { - videoIDVKNew = getVideoId("vk"); - if (videoIDVK !== videoIDVKNew) { - if (videoIDVKNew) { - const el = await waitForElm(config_selectors.vkSelector); - if (el) { - await translateProccessor(el, "vk", null); - } - } - videoIDVK = videoIDVKNew; - } - }, 3000); - } - } else if (window.location.hostname.includes("vimeo.com")) { - debug/* default */.Z.log("[entered] vimeo.com"); - const el = await waitForElm(config_selectors.vimeoSelector); - if (el) { - await sleep(1000); - await translateProccessor( - document.querySelector(config_selectors.vimeoSelector), - "vimeo", - null - ); - } - } else if (window.location.hostname.includes("9gag.com")) { - await sleep(1000); - await translateProccessor( - document.querySelector(config_selectors.gagSelector), - "9gag", - null - ); - } else if (window.location.hostname.includes("coub.com")) { - await sleep(1000); - await translateProccessor( - document.querySelector(".viewer__player"), - "coub", - null - ); - } else if (window.location.hostname.includes("rutube.ru")) { - const elementSelector = window.location.pathname.includes("/play/embed") - ? "#app > div > div" - : ".video-player > div > div > div:nth-child(2)"; - - const el = await waitForElm(elementSelector); - if (el) { - await translateProccessor(el, "rutube", null); - } - } else if (window.location.hostname.includes("bilibili.com")) { - if (window.location.pathname.includes("/video/")) { - const el = await waitForElm(config_selectors.bilibilicomSelector); - if (el) { - await translateProccessor(el, "bilibili.com", null); - } - } else if ( - window.location.pathname.includes( - "/blackboard/webplayer/embed-old.html" - ) - ) { - const el = await waitForElm("video"); - if (el) { - await translateProccessor(el.parentElement, "bilibili.com", null); - } - } - } else if (window.location.hostname.includes("twitter.com")) { - const el = await waitForElm(config_selectors.twitterSelector); - if (el) { - let videoIDNew; - let videoID = getVideoId("twitter"); - await translateProccessor(el, "twitter", null); - setInterval(async () => { - videoIDNew = getVideoId("twitter"); - if (videoID !== videoIDNew) { - if (videoIDNew) { - await translateProccessor( - document.querySelector(config_selectors.twitterSelector), - "twitter", - null - ); - } - videoID = videoIDNew; - } - }, 3000); - } - } else if (window.location.hostname.includes("my.mail.ru")) { - const el = await waitForElm(config_selectors.mailSelector); - if (el) { - let videoIDNew; - let videoID = getVideoId("mail.ru"); - await translateProccessor(el, "mail.ru", null); - setInterval(async () => { - videoIDNew = getVideoId("mail.ru"); - if (videoID !== videoIDNew) { - if (videoIDNew) { - await translateProccessor( - document.querySelector(config_selectors.mailSelector), - "mail.ru", - null - ); - } - videoID = videoIDNew; - } - }, 3000); - } - } - } - - await initWebsite(); -} - -src_main().catch((e) => { - console.error(e); -}); - -})(); - -/******/ })() -; \ No newline at end of file diff --git a/src/dist/vot-min.user.js b/src/dist/vot-min.user.js deleted file mode 100644 index c7371043..00000000 --- a/src/dist/vot-min.user.js +++ /dev/null @@ -1,86 +0,0 @@ -// ==UserScript== -// @name [VOT] - Voice Over Translation -// @name:de [VOT] - Voice-Over-Video-Übersetzung -// @name:es [VOT] - Traducción de vídeo en off -// @name:fr [VOT] - Traduction vidéo voix-off -// @name:it [VOT] - Traduzione Video fuori campo -// @name:ru [VOT] - Закадровый перевод видео -// @name:zh [VOT] - 画外音视频翻译 -// @description A small extension that adds a Yandex Browser video translation to other browsers -// @description:de Eine kleine Erweiterung, die eine Voice-over-Übersetzung von Videos aus dem Yandex-Browser zu anderen Browsern hinzufügt -// @description:es Una pequeña extensión que agrega una traducción de voz en off de un video de Yandex Browser a otros navegadores -// @description:fr Une petite extension qui ajoute la traduction vocale de la vidéo du Navigateur Yandex à d'autres navigateurs -// @description:it Una piccola estensione che aggiunge la traduzione vocale del video dal browser Yandex ad altri browser -// @description:ru Небольшое расширение, которое добавляет закадровый перевод видео из Яндекс Браузера в другие браузеры -// @description:zh 一个小扩展,它增加了视频从Yandex浏览器到其他浏览器的画外音翻译 -// @version 1.3.4-testing -// @author sodapng, mynovelhost, Toil, SashaXser -// @supportURL https://github.com/ilyhalight/voice-over-translation/issues -// @match *://*.youtube.com/* -// @match *://*.youtube-nocookie.com/* -// @match *://*.twitch.tv/* -// @match *://*.xvideos.com/* -// @match *://*.pornhub.com/* -// @match *://*.vk.com/* -// @match *://*.vk.ru/* -// @match *://invidious.snopyta.org/* -// @match *://invidious.kavin.rocks/* -// @match *://vid.puffyan.us/* -// @match *://invidious.namazso.eu/* -// @match *://inv.riverside.rocks/* -// @match *://yt.artemislena.eu/* -// @match *://invidious.flokinet.to/* -// @match *://invidious.esmailelbob.xyz/* -// @match *://invidious.nerdvpn.de/* -// @match *://invidious.slipfox.xyz/* -// @match *://invidio.xamh.de/* -// @match *://invidious.dhusch.de/* -// @match *://*.piped.video/* -// @match *://piped.tokhmi.xyz/* -// @match *://piped.moomoo.me/* -// @match *://piped.syncpundit.io/* -// @match *://piped.mha.fi/* -// @match *://watch.whatever.social/* -// @match *://piped.garudalinux.org/* -// @match *://efy.piped.pages.dev/* -// @match *://watch.leptons.xyz/* -// @match *://piped.lunar.icu/* -// @match *://yt.dc09.ru/* -// @match *://piped.mint.lgbt/* -// @match *://*.il.ax/* -// @match *://piped.privacy.com.de/* -// @match *://piped.esmailelbob.xyz/* -// @match *://piped.projectsegfau.lt/* -// @match *://piped.in.projectsegfau.lt/* -// @match *://piped.us.projectsegfau.lt/* -// @match *://piped.privacydev.net/* -// @match *://piped.palveluntarjoaja.eu/* -// @match *://piped.smnz.de/* -// @match *://piped.adminforge.de/* -// @match *://piped.qdi.fi/* -// @match *://piped.hostux.net/* -// @match *://piped.chauvet.pro/* -// @match *://piped.jotoma.de/* -// @match *://piped.pfcd.me/* -// @match *://piped.frontendfriendly.xyz/* -// @match *://*.yewtu.be/* -// @match *://inv.vern.cc/* -// @match *://*.vimeo.com/* -// @match *://*.9gag.com/* -// @match *://*.twitter.com/* -// @match *://*.facebook.com/* -// @match *://*.rutube.ru/* -// @match *://*.bilibili.com/* -// @match *://my.mail.ru/* -// @connect api.browser.yandex.ru -// @downloadURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js -// @grant GM_xmlhttpRequest -// @grant GM_info -// @homepageURL https://github.com/ilyhalight/voice-over-translation/issues -// @icon https://translate.yandex.ru/icons/favicon.ico -// @namespace vot -// @require https://cdnjs.cloudflare.com/ajax/libs/protobufjs/7.2.3/protobuf.min.js -// @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js -// ==/UserScript== - -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>a,IM:()=>r,Rr:()=>i,iF:()=>o});const o="api.browser.yandex.ru",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var a=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=o(!0),d=a.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},b={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},y={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function k(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function L(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function F(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in y||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${y[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=y[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(B);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,z)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=y[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=y[V].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=y[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=y[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=y[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${y[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${y[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:y[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:y[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:y[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:y[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),o=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),_=await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=y[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=y[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(y[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),j(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=y[V].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=x("VOTAutoTranslate",O,y[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${y[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=x("VOTDontTranslateYourLang",E,y[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=x("VOTAutoSetVolume",M,y[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=x("VOTShowVideoSlider",D,y[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=x("VOTSyncVolume",I,y[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}function Y(e,t=V){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t)}async function G(e,t){switch(t){case"en":e.detectedLanguage=t,e.responseLanguage=V;break;case"ru":e.detectedLanguage=t,e.responseLanguage=V,"ru"==V&&(e.responseLanguage="en");break;default:if(!Object.keys(v).includes(t))return G(e,"en");e.detectedLanguage=t}return Y(e.detectedLanguage,e.responseLanguage),e}async function W(e,t){if("en"===t)e.responseLanguage=t,e.detectedLanguage="ru";else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return Y(e.detectedLanguage,e.responseLanguage),e}function Z(){o.pause(),c.removeEventListener(".translate",Z,!1),o.src="",o.removeAttribute("src"),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",k("none",y[V].translateVideo),m&&(c.volume=m)}function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}k("none",y[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=(e=!1)=>{if(f.log("lipsync video",c),c)if(o.currentTime=c.currentTime,o.playbackRate=c.playbackRate,e)if("play"!==e)f.log(`lipsync mode is ${e}`),o.pause(),"playing"===e&&(f.log("lipsync mode is playing"),o.play());else{f.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=y[V].grantPermissionToAutoPlay;throw k("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?y[V].neededAdditionalExtension:y[V].audioFormatNotSupported;throw k("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${y[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=$(o,n,i,g);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(te=G(te,te.detectedLanguage),f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V)throw z=!1,y[V].VOTDisableFromYourLang;if(te.isLive)throw y[V].VOTLiveNotSupported;if(te.isPremiere)throw y[V].VOTPremiere;if(_.duration>14400)throw y[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await ae(e,_.detectedLanguage,_.responseLanguage)};function ne(e){f.log(`video ${e.type}`),J(e.type)}function oe(){Z(),K()}function ae(t,a,i){!function(t,n,o,a,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),e(t,n,o,a,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,y[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||y[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?y[V].translationTakeMoreThanHour:t>=10&&t%10?y[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?y[V].translationTakeAboutMinute:y[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):y[V].translationTakeFewMinutes);break;case 3:i(!1,y[V].videoBeingTranslated)}}))}(`${b[d]}${t}`,0x4075500000000000,a,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw k("error",r),r.includes(y[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>ae(t,a,i)),6e4)),r;switch(o.src=r,m=c?.volume,"number"==typeof S&&(o.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(oe(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),k("success",y[V].disableTranslate),X(),function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${y[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=$(c,e,n,w);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),g=o,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const b=document.querySelector(".translationDownload");b.href=r,b.style.display="initial"}))}document.addEventListener("click",(e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${a} ${s} ${l}`),a||s||(l||r(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,n)))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,a))),document.addEventListener("touchstart",(e=>l(e,t,a))),document.addEventListener("touchmove",(e=>l(e,t,a))),document.addEventListener("touchend",(e=>l(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return f.log("[click translationBtn] audio.src is not empty"),void Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw y[V].VOTNoVideoIDFound;await Q(e)}catch(e){k("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw y[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){k("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/src/dist/vot.user.js b/src/dist/vot.user.js deleted file mode 100644 index 3f174b9b..00000000 --- a/src/dist/vot.user.js +++ /dev/null @@ -1,3815 +0,0 @@ -// ==UserScript== -// @name [VOT] - Voice Over Translation -// @name:de [VOT] - Voice-Over-Video-Übersetzung -// @name:es [VOT] - Traducción de vídeo en off -// @name:fr [VOT] - Traduction vidéo voix-off -// @name:it [VOT] - Traduzione Video fuori campo -// @name:ru [VOT] - Закадровый перевод видео -// @name:zh [VOT] - 画外音视频翻译 -// @description A small extension that adds a Yandex Browser video translation to other browsers -// @description:de Eine kleine Erweiterung, die eine Voice-over-Übersetzung von Videos aus dem Yandex-Browser zu anderen Browsern hinzufügt -// @description:es Una pequeña extensión que agrega una traducción de voz en off de un video de Yandex Browser a otros navegadores -// @description:fr Une petite extension qui ajoute la traduction vocale de la vidéo du Navigateur Yandex à d'autres navigateurs -// @description:it Una piccola estensione che aggiunge la traduzione vocale del video dal browser Yandex ad altri browser -// @description:ru Небольшое расширение, которое добавляет закадровый перевод видео из Яндекс Браузера в другие браузеры -// @description:zh 一个小扩展,它增加了视频从Yandex浏览器到其他浏览器的画外音翻译 -// @version 1.3.4-testing -// @author sodapng, mynovelhost, Toil, SashaXser -// @supportURL https://github.com/ilyhalight/voice-over-translation/issues -// @match *://*.youtube.com/* -// @match *://*.youtube-nocookie.com/* -// @match *://*.twitch.tv/* -// @match *://*.xvideos.com/* -// @match *://*.pornhub.com/* -// @match *://*.vk.com/* -// @match *://*.vk.ru/* -// @match *://invidious.snopyta.org/* -// @match *://invidious.kavin.rocks/* -// @match *://vid.puffyan.us/* -// @match *://invidious.namazso.eu/* -// @match *://inv.riverside.rocks/* -// @match *://yt.artemislena.eu/* -// @match *://invidious.flokinet.to/* -// @match *://invidious.esmailelbob.xyz/* -// @match *://invidious.nerdvpn.de/* -// @match *://invidious.slipfox.xyz/* -// @match *://invidio.xamh.de/* -// @match *://invidious.dhusch.de/* -// @match *://*.piped.video/* -// @match *://piped.tokhmi.xyz/* -// @match *://piped.moomoo.me/* -// @match *://piped.syncpundit.io/* -// @match *://piped.mha.fi/* -// @match *://watch.whatever.social/* -// @match *://piped.garudalinux.org/* -// @match *://efy.piped.pages.dev/* -// @match *://watch.leptons.xyz/* -// @match *://piped.lunar.icu/* -// @match *://yt.dc09.ru/* -// @match *://piped.mint.lgbt/* -// @match *://*.il.ax/* -// @match *://piped.privacy.com.de/* -// @match *://piped.esmailelbob.xyz/* -// @match *://piped.projectsegfau.lt/* -// @match *://piped.in.projectsegfau.lt/* -// @match *://piped.us.projectsegfau.lt/* -// @match *://piped.privacydev.net/* -// @match *://piped.palveluntarjoaja.eu/* -// @match *://piped.smnz.de/* -// @match *://piped.adminforge.de/* -// @match *://piped.qdi.fi/* -// @match *://piped.hostux.net/* -// @match *://piped.chauvet.pro/* -// @match *://piped.jotoma.de/* -// @match *://piped.pfcd.me/* -// @match *://piped.frontendfriendly.xyz/* -// @match *://*.yewtu.be/* -// @match *://inv.vern.cc/* -// @match *://*.vimeo.com/* -// @match *://*.9gag.com/* -// @match *://*.twitter.com/* -// @match *://*.facebook.com/* -// @match *://*.rutube.ru/* -// @match *://*.bilibili.com/* -// @match *://my.mail.ru/* -// @connect api.browser.yandex.ru -// @downloadURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js -// @grant GM_xmlhttpRequest -// @grant GM_info -// @homepageURL https://github.com/ilyhalight/voice-over-translation/issues -// @icon https://translate.yandex.ru/icons/favicon.ico -// @namespace vot -// @require https://cdnjs.cloudflare.com/ajax/libs/protobufjs/7.2.3/protobuf.min.js -// @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js -// ==/UserScript== - -/******/ (() => { // webpackBootstrap -/******/ "use strict"; -/******/ var __webpack_modules__ = ({ - -/***/ "./node_modules/css-loader/dist/cjs.js!./src/styles/main.css": -/***/ ((module, __webpack_exports__, __webpack_require__) => { - -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./node_modules/css-loader/dist/runtime/noSourceMaps.js"); -/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./node_modules/css-loader/dist/runtime/api.js"); -/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__); -// Imports - - -var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default())); -// Module -___CSS_LOADER_EXPORT___.push([module.id, `.translationBlock { - padding: 0.45rem !important; - width: max-content; - position: absolute; - background: #2e2f34; - border-radius: 0.5rem !important; - left: 50%; - top: 5rem; - transform: translate(-50%); - text-align: center; - opacity: 0; - transition: opacity 1s; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - z-index: 100; -} - -.translationBtn { - position: relative; - display: inline-block; - vertical-align: middle; - color: #fff; - padding-right: 0.25rem !important; - cursor: pointer; - font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif; -} - -.translationBlock:hover { - opacity: 1; -} - -.translationMenu { - display: inline-block; - vertical-align: middle; - border-left: 1px solid #424348; - max-height: 16px; - max-width: 24px; - cursor: pointer; -} - -.translationMenuIcon { - padding: 0 10px !important; - width: 24px; -} - -.translationIAlice { - display: inline-block; - vertical-align: middle; - max-height: 26px; - max-width: 50px; -} - -.translationIconAlice { - height: 24px !important; - width: 24px !important; -} - -.translationITranslate { - display: inline-block; - vertical-align: middle; - max-height: 20px; - max-width: 20px; -} - -.translationMenuContent { - position: absolute; - background: #2e2f34; - color: #fff; - display: none; - border-radius: 1rem !important; - left: 50%; - top: 10rem; - transform: translate(-50%); - text-align: left; - font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important; - - width: 300px; - /* height: 375px; */ - opacity: 0; - z-index: 100; - transition: opacity 0.5s ease; -} - -.VOTMenuSlider { - -webkit-appearance: none !important; - appearance: none !important; - width: 268px !important; - height: 8px !important; - outline: none !important; - margin-top: 0.5rem; - opacity: 0.7; - /* background: #3C3F4D !important; */ - background: rgb(253, 222, 85, 0.6) !important; - border: none !important; - border-radius: 2rem !important; - -webkit-transition: 0.2s !important; - transition: opacity 0.2s ease !important; -} - -.VOTMenuSlider:hover { - opacity: 1; -} - -.VOTMenuSlider::-webkit-slider-thumb { - -webkit-appearance: none !important; - appearance: none !important; - width: 10px !important; - height: 10px !important; - border-radius: 50% !important; - border: none !important; - background: #fff !important; - cursor: pointer !important; -} - -.VOTMenuSlider::-moz-range-thumb { - width: 10px !important; - height: 10px !important; - border-radius: 50% !important; - border: none !important; - background: #fff !important; - cursor: pointer !important; -} - -.VOTMenuSlider::-ms-thumb { - width: 10px !important; - height: 10px !important; - border-radius: 50% !important; - border: none !important; - background: #fff !important; - cursor: pointer !important; -} - -.VOTMenuSlider::-ms-fill-lower { - height: 8px !important; - border-radius: 2rem !important; - background: linear-gradient( - 90.1deg, - rgba(186, 153, 244, 0.85) -5.78%, - rgba(236, 138, 202, 0.7) 56.46%, - rgba(239, 168, 117, 0.6) 108.93% - ) !important; -} - -.VOTMenuSlider::-moz-range-progress { - height: 8px !important; - border-radius: 2rem !important; - background: linear-gradient( - 90.1deg, - rgba(186, 153, 244, 0.85) -5.78%, - rgba(236, 138, 202, 0.7) 56.46%, - rgba(239, 168, 117, 0.6) 108.93% - ) !important; -} - -.translationHeader { - padding-bottom: 0.5rem !important; -} - -.translationMainHeader { - margin: 16px !important; - color: #fff; - font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important; -} - -.translationMenuOptions { - display: flex; - flex-flow: column wrap; -} - -.translationMenuContainer { - /* width: 100%; */ - padding-left: 16px !important; - padding-top: 5px !important; - display: inline-block !important; -} - -.translationMenuContainer > input { - appearance: auto !important; - vertical-align: text-bottom; -} - -.translationMenuText { - color: #fff; - display: inline-flex; - width: 80%; -} - -.translationVolumeBox, -.translationVideoVolumeBox { - padding-top: 0.5rem !important; -} - -.translationDropDB { - border: none !important; - border-radius: 4px !important; - background: #5426ff !important; - color: #fff !important; - padding: 6px 16px !important; - margin-left: auto !important; - cursor: pointer !important; -} - -.translationDownload { - background: #5426ff !important; - color: #fff !important; - padding: 2px 10px !important; - border-radius: 4px !important; - cursor: pointer; - display: none; -} - -.translationMenuFunctional { - display: flex; - margin: 16px !important; -} - -.VOTMenuSelect { - width: 110px; - border-radius: 5px !important; - border: 1px solid #dadce0 !important; - box-shadow: 0 1px 3px -2px #9098a9; - box-sizing: border-box !important; - color: #2e2f34 !important; - background: #fff !important; - padding: 5px !important; -} - -.VOTMenuSelect:focus { - outline: none; -} - -.VOTMenuSelect:focus { - outline: none; - border-color: #0077ff; - box-shadow: 0 0 0 2px rgba(#0077ff, 0.2); -} - -#VOTSelectLanguages { - display: flex !important; - margin-left: 5px; -} - -#VOTSelectLanguages svg { - margin: 0 5px; -} -`, ""]); -// Exports -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___); - - -/***/ }), - -/***/ "./node_modules/css-loader/dist/runtime/api.js": -/***/ ((module) => { - - - -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ -module.exports = function (cssWithMappingToString) { - var list = []; - - // return the list of modules as css string - list.toString = function toString() { - return this.map(function (item) { - var content = ""; - var needLayer = typeof item[5] !== "undefined"; - if (item[4]) { - content += "@supports (".concat(item[4], ") {"); - } - if (item[2]) { - content += "@media ".concat(item[2], " {"); - } - if (needLayer) { - content += "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {"); - } - content += cssWithMappingToString(item); - if (needLayer) { - content += "}"; - } - if (item[2]) { - content += "}"; - } - if (item[4]) { - content += "}"; - } - return content; - }).join(""); - }; - - // import a list of modules into the list - list.i = function i(modules, media, dedupe, supports, layer) { - if (typeof modules === "string") { - modules = [[null, modules, undefined]]; - } - var alreadyImportedModules = {}; - if (dedupe) { - for (var k = 0; k < this.length; k++) { - var id = this[k][0]; - if (id != null) { - alreadyImportedModules[id] = true; - } - } - } - for (var _k = 0; _k < modules.length; _k++) { - var item = [].concat(modules[_k]); - if (dedupe && alreadyImportedModules[item[0]]) { - continue; - } - if (typeof layer !== "undefined") { - if (typeof item[5] === "undefined") { - item[5] = layer; - } else { - item[1] = "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {").concat(item[1], "}"); - item[5] = layer; - } - } - if (media) { - if (!item[2]) { - item[2] = media; - } else { - item[1] = "@media ".concat(item[2], " {").concat(item[1], "}"); - item[2] = media; - } - } - if (supports) { - if (!item[4]) { - item[4] = "".concat(supports); - } else { - item[1] = "@supports (".concat(item[4], ") {").concat(item[1], "}"); - item[4] = supports; - } - } - list.push(item); - } - }; - return list; -}; - -/***/ }), - -/***/ "./node_modules/css-loader/dist/runtime/noSourceMaps.js": -/***/ ((module) => { - - - -module.exports = function (i) { - return i[1]; -}; - -/***/ }), - -/***/ "./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js": -/***/ ((module) => { - - - -var stylesInDOM = []; -function getIndexByIdentifier(identifier) { - var result = -1; - for (var i = 0; i < stylesInDOM.length; i++) { - if (stylesInDOM[i].identifier === identifier) { - result = i; - break; - } - } - return result; -} -function modulesToDom(list, options) { - var idCountMap = {}; - var identifiers = []; - for (var i = 0; i < list.length; i++) { - var item = list[i]; - var id = options.base ? item[0] + options.base : item[0]; - var count = idCountMap[id] || 0; - var identifier = "".concat(id, " ").concat(count); - idCountMap[id] = count + 1; - var indexByIdentifier = getIndexByIdentifier(identifier); - var obj = { - css: item[1], - media: item[2], - sourceMap: item[3], - supports: item[4], - layer: item[5] - }; - if (indexByIdentifier !== -1) { - stylesInDOM[indexByIdentifier].references++; - stylesInDOM[indexByIdentifier].updater(obj); - } else { - var updater = addElementStyle(obj, options); - options.byIndex = i; - stylesInDOM.splice(i, 0, { - identifier: identifier, - updater: updater, - references: 1 - }); - } - identifiers.push(identifier); - } - return identifiers; -} -function addElementStyle(obj, options) { - var api = options.domAPI(options); - api.update(obj); - var updater = function updater(newObj) { - if (newObj) { - if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap && newObj.supports === obj.supports && newObj.layer === obj.layer) { - return; - } - api.update(obj = newObj); - } else { - api.remove(); - } - }; - return updater; -} -module.exports = function (list, options) { - options = options || {}; - list = list || []; - var lastIdentifiers = modulesToDom(list, options); - return function update(newList) { - newList = newList || []; - for (var i = 0; i < lastIdentifiers.length; i++) { - var identifier = lastIdentifiers[i]; - var index = getIndexByIdentifier(identifier); - stylesInDOM[index].references--; - } - var newLastIdentifiers = modulesToDom(newList, options); - for (var _i = 0; _i < lastIdentifiers.length; _i++) { - var _identifier = lastIdentifiers[_i]; - var _index = getIndexByIdentifier(_identifier); - if (stylesInDOM[_index].references === 0) { - stylesInDOM[_index].updater(); - stylesInDOM.splice(_index, 1); - } - } - lastIdentifiers = newLastIdentifiers; - }; -}; - -/***/ }), - -/***/ "./node_modules/style-loader/dist/runtime/insertBySelector.js": -/***/ ((module) => { - - - -var memo = {}; - -/* istanbul ignore next */ -function getTarget(target) { - if (typeof memo[target] === "undefined") { - var styleTarget = document.querySelector(target); - - // Special case to return head of iframe instead of iframe itself - if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) { - try { - // This will throw an exception if access to iframe is blocked - // due to cross-origin restrictions - styleTarget = styleTarget.contentDocument.head; - } catch (e) { - // istanbul ignore next - styleTarget = null; - } - } - memo[target] = styleTarget; - } - return memo[target]; -} - -/* istanbul ignore next */ -function insertBySelector(insert, style) { - var target = getTarget(insert); - if (!target) { - throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid."); - } - target.appendChild(style); -} -module.exports = insertBySelector; - -/***/ }), - -/***/ "./node_modules/style-loader/dist/runtime/insertStyleElement.js": -/***/ ((module) => { - - - -/* istanbul ignore next */ -function insertStyleElement(options) { - var element = document.createElement("style"); - options.setAttributes(element, options.attributes); - options.insert(element, options.options); - return element; -} -module.exports = insertStyleElement; - -/***/ }), - -/***/ "./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js": -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - - -/* istanbul ignore next */ -function setAttributesWithoutAttributes(styleElement) { - var nonce = true ? __webpack_require__.nc : 0; - if (nonce) { - styleElement.setAttribute("nonce", nonce); - } -} -module.exports = setAttributesWithoutAttributes; - -/***/ }), - -/***/ "./node_modules/style-loader/dist/runtime/styleDomAPI.js": -/***/ ((module) => { - - - -/* istanbul ignore next */ -function apply(styleElement, options, obj) { - var css = ""; - if (obj.supports) { - css += "@supports (".concat(obj.supports, ") {"); - } - if (obj.media) { - css += "@media ".concat(obj.media, " {"); - } - var needLayer = typeof obj.layer !== "undefined"; - if (needLayer) { - css += "@layer".concat(obj.layer.length > 0 ? " ".concat(obj.layer) : "", " {"); - } - css += obj.css; - if (needLayer) { - css += "}"; - } - if (obj.media) { - css += "}"; - } - if (obj.supports) { - css += "}"; - } - var sourceMap = obj.sourceMap; - if (sourceMap && typeof btoa !== "undefined") { - css += "\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), " */"); - } - - // For old IE - /* istanbul ignore if */ - options.styleTagTransform(css, styleElement, options.options); -} -function removeStyleElement(styleElement) { - // istanbul ignore if - if (styleElement.parentNode === null) { - return false; - } - styleElement.parentNode.removeChild(styleElement); -} - -/* istanbul ignore next */ -function domAPI(options) { - if (typeof document === "undefined") { - return { - update: function update() {}, - remove: function remove() {} - }; - } - var styleElement = options.insertStyleElement(options); - return { - update: function update(obj) { - apply(styleElement, options, obj); - }, - remove: function remove() { - removeStyleElement(styleElement); - } - }; -} -module.exports = domAPI; - -/***/ }), - -/***/ "./node_modules/style-loader/dist/runtime/styleTagTransform.js": -/***/ ((module) => { - - - -/* istanbul ignore next */ -function styleTagTransform(css, styleElement) { - if (styleElement.styleSheet) { - styleElement.styleSheet.cssText = css; - } else { - while (styleElement.firstChild) { - styleElement.removeChild(styleElement.firstChild); - } - styleElement.appendChild(document.createTextNode(css)); - } -} -module.exports = styleTagTransform; - -/***/ }), - -/***/ "./src/config/config.js": -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ I1: () => (/* binding */ yandexHmacKey), -/* harmony export */ IM: () => (/* binding */ autoVolume), -/* harmony export */ Rr: () => (/* binding */ yandexUserAgent), -/* harmony export */ iF: () => (/* binding */ workerHost) -/* harmony export */ }); -// CONFIGURATION -const workerHost = "api.browser.yandex.ru"; -const yandexHmacKey = "gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"; -const yandexUserAgent = - "Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1"; -const autoVolume = 0.15; // 0.0 - 1.0 (0% - 100%) - default volume of the video with the translation - - - - -/***/ }), - -/***/ "./src/rvt.js": -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -// ESM COMPAT FLAG -__webpack_require__.r(__webpack_exports__); - -// EXPORTS -__webpack_require__.d(__webpack_exports__, { - "default": () => (/* binding */ rvt) -}); - -;// CONCATENATED MODULE: ./src/getUUID.js -function getUUID(isLower) { - const uuid = ([1e7] + 1e3 + 4e3 + 8e3 + 1e11).replace(/[018]/g, (c) => - ( - c ^ - (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4))) - ).toString(16) - ); - return isLower ? uuid : uuid.toUpperCase(); -} - - - -// EXTERNAL MODULE: ./src/yandexRequests.js -var yandexRequests = __webpack_require__("./src/yandexRequests.js"); -// EXTERNAL MODULE: ./src/config/config.js -var config = __webpack_require__("./src/config/config.js"); -;// CONCATENATED MODULE: ./src/rvt.js - - - - -// Request video translation from Yandex API -async function requestVideoTranslation( - url, - unknown1, - requestLang, - responseLang, - callback -) { - // Initialize variables - const deviceId = getUUID(true); - const body = yandexRequests/* yandexRequests */.G.encodeRequest( - url, - deviceId, - unknown1, - requestLang, - responseLang - ); - - try { - // Create a key from the HMAC secret - const utf8Encoder = new TextEncoder("utf-8"); - const key = await window.crypto.subtle.importKey( - "raw", - utf8Encoder.encode(config/* yandexHmacKey */.I1), - { name: "HMAC", hash: { name: "SHA-256" } }, - false, - ["sign", "verify"] - ); - // Sign the body with the key - const signature = await window.crypto.subtle.sign("HMAC", key, body); - // Convert the signature to a hex string - const hexSignature = Array.from(new Uint8Array(signature), (x) => - x.toString(16).padStart(2, "0") - ).join(""); - // Create a fetch options object with headers and body - const options = { - // url: `https://${workerHost}/stream-translation/whitelist-stream`, - // url: `https://${workerHost}/stream-translation/translate-stream`, - url: `https://${config/* workerHost */.iF}/video-translation/translate`, - method: "POST", - headers: { - Accept: "application/x-protobuf", - "Accept-Language": "en", - "Content-Type": "application/x-protobuf", - "User-Agent": config/* yandexUserAgent */.Rr, - Pragma: "no-cache", - "Cache-Control": "no-cache", - "Sec-Fetch-Mode": "no-cors", - "sec-ch-ua": null, - "sec-ch-ua-mobile": null, - "sec-ch-ua-platform": null, - "Vtrans-Signature": hexSignature, - "Sec-Vtrans-Token": getUUID(false), - }, - data: String.fromCharCode(...body), - responseType: "arraybuffer", - }; - // Send the request using GM_xmlhttpRequest - GM_xmlhttpRequest({ - ...options, - onload: (http) => { - callback(http.status === 200, http.response); - }, - onerror: (error) => { - callback(false); - }, - }); - } catch (exception) { - // Handle errors - callback(false); - } -} - -/* harmony default export */ const rvt = (requestVideoTranslation); - - -/***/ }), - -/***/ "./src/yandexRequests.js": -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ G: () => (/* binding */ yandexRequests) -/* harmony export */ }); -const VideoTranslationRequest = new protobuf.Type("VideoTranslationRequest") - .add(new protobuf.Field("url", 3, "string")) - .add(new protobuf.Field("deviceId", 4, "string")) - .add(new protobuf.Field("firstRequest", 5, "bool")) // true for the first request, false for subsequent ones - .add(new protobuf.Field("unknown1", 6, "fixed64")) - .add(new protobuf.Field("unknown2", 7, "int32")) // 1 1 - .add(new protobuf.Field("language", 8, "string")) // source language code - .add(new protobuf.Field("unknown3", 9, "int32")) // 0 0 - .add(new protobuf.Field("unknown4", 10, "int32")) // 0 0 - .add(new protobuf.Field("translationHelp", 11, "int32")) // array for translation assistance ([0] -> {2: link to video, 1: "video_file_url"}, [1] -> {2: link to subtitles, 1: "subtitles_file_url"}) - .add(new protobuf.Field("responseLanguage", 14, "string")); // target language code - -// const VideoWhitelistStreamRequest = new protobuf.Type("VideoWhitelistStreamRequest") -// .add(new protobuf.Field("url", 1, "string")) -// .add(new protobuf.Field("deviceId", 4, "string")) - -// const VideoTranslationStreamRequest = new protobuf.Type("VideoTranslationStreamRequest") -// .add(new protobuf.Field("url", 1, "string")) -// .add(new protobuf.Field("language", 2, "string")) -// .add(new protobuf.Field("responseLanguage", 3, "string")) - -const VideoTranslationResponse = new protobuf.Type("VideoTranslationResponse") - .add(new protobuf.Field("url", 1, "string")) - .add(new protobuf.Field("duration", 2, "double")) - .add(new protobuf.Field("status", 4, "int32")) // status - .add(new protobuf.Field("remainingTime", 5, "int32")) // secs before translation - .add(new protobuf.Field("language", 8, "string")) // detected language (if the wrong one is set) - .add(new protobuf.Field("message", 9, "string")); -// 6 - unknown 0 (1st request) -> 10 (2nd, 3th and etc requests) -// 7 - unknown array - -// const VideoWhitelistStreamResponse = new protobuf.Type("VideoWhitelistStreamResponse") -// .add(new protobuf.Field("inWhitelist", 1, "bool")) - -// const VideoTranslationStreamResponse = new protobuf.Type("VideoTranslationStreamResponse") -// .add(new protobuf.Field("unknown1", 1, "int32")) -// .add(new protobuf.Field("array", 2, "string")) -// .add(new protobuf.Field("ping", 3, "int32")) - -// Create a root namespace and add the types -// const root = new protobuf.Root().define("yandex").add(VideoWhitelistStreamRequest).add(VideoWhitelistStreamResponse); - -// // Export the encoding and decoding functions -// export const yandexRequests = { -// encodeRequest(url, deviceId, unknown1, requestLang, responseLang) { -// return root.VideoWhitelistStreamRequest.encode({ -// url, -// deviceId: 'UCLA_DiR1FfKNvjuUpBHmylQ' -// }).finish(); -// }, -// decodeResponse(response) { -// return root.VideoWhitelistStreamResponse.decode(new Uint8Array(response)); -// } -// }; - -// // Create a root namespace and add the types -// const root = new protobuf.Root().define("yandex").add(VideoTranslationStreamRequest).add(VideoTranslationStreamResponse); - -// // Export the encoding and decoding functions -// export const yandexRequests = { -// encodeRequest(url, deviceId, unknown1, requestLang, responseLang) { -// return root.VideoTranslationStreamRequest.encode({ -// url, -// language: requestLang, -// responseLanguage: responseLang -// }).finish(); -// }, -// decodeResponse(response) { -// return root.VideoTranslationStreamResponse.decode(new Uint8Array(response)); -// } -// }; - -// Create a root namespace and add the types -const root = new protobuf.Root() - .define("yandex") - .add(VideoTranslationRequest) - .add(VideoTranslationResponse); - -// Export the encoding and decoding functions -const yandexRequests = { - encodeRequest(url, deviceId, unknown1, requestLang, responseLang) { - return root.VideoTranslationRequest.encode({ - url, - deviceId, - firstRequest: true, - unknown1, - unknown2: 1, - language: requestLang, - unknown3: 0, - unknown4: 0, - responseLanguage: responseLang, - }).finish(); - }, - decodeResponse(response) { - return root.VideoTranslationResponse.decode(new Uint8Array(response)); - }, -}; - - -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ // Check if module is in cache -/******/ var cachedModule = __webpack_module_cache__[moduleId]; -/******/ if (cachedModule !== undefined) { -/******/ return cachedModule.exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = __webpack_module_cache__[moduleId] = { -/******/ id: moduleId, -/******/ // no module.loaded needed -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/compat get default export */ -/******/ (() => { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = (module) => { -/******/ var getter = module && module.__esModule ? -/******/ () => (module['default']) : -/******/ () => (module); -/******/ __webpack_require__.d(getter, { a: getter }); -/******/ return getter; -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/define property getters */ -/******/ (() => { -/******/ // define getter functions for harmony exports -/******/ __webpack_require__.d = (exports, definition) => { -/******/ for(var key in definition) { -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ (() => { -/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) -/******/ })(); -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ (() => { -/******/ // define __esModule on exports -/******/ __webpack_require__.r = (exports) => { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/nonce */ -/******/ (() => { -/******/ __webpack_require__.nc = undefined; -/******/ })(); -/******/ -/************************************************************************/ -var __webpack_exports__ = {}; -// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. -(() => { - -// EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js -var injectStylesIntoStyleTag = __webpack_require__("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"); -var injectStylesIntoStyleTag_default = /*#__PURE__*/__webpack_require__.n(injectStylesIntoStyleTag); -// EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/styleDomAPI.js -var styleDomAPI = __webpack_require__("./node_modules/style-loader/dist/runtime/styleDomAPI.js"); -var styleDomAPI_default = /*#__PURE__*/__webpack_require__.n(styleDomAPI); -// EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/insertBySelector.js -var insertBySelector = __webpack_require__("./node_modules/style-loader/dist/runtime/insertBySelector.js"); -var insertBySelector_default = /*#__PURE__*/__webpack_require__.n(insertBySelector); -// EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js -var setAttributesWithoutAttributes = __webpack_require__("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"); -var setAttributesWithoutAttributes_default = /*#__PURE__*/__webpack_require__.n(setAttributesWithoutAttributes); -// EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/insertStyleElement.js -var insertStyleElement = __webpack_require__("./node_modules/style-loader/dist/runtime/insertStyleElement.js"); -var insertStyleElement_default = /*#__PURE__*/__webpack_require__.n(insertStyleElement); -// EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/styleTagTransform.js -var styleTagTransform = __webpack_require__("./node_modules/style-loader/dist/runtime/styleTagTransform.js"); -var styleTagTransform_default = /*#__PURE__*/__webpack_require__.n(styleTagTransform); -// EXTERNAL MODULE: ./node_modules/css-loader/dist/cjs.js!./src/styles/main.css -var main = __webpack_require__("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"); -;// CONCATENATED MODULE: ./src/styles/main.css - - - - - - - - - - - -var options = {}; - -options.styleTagTransform = (styleTagTransform_default()); -options.setAttributes = (setAttributesWithoutAttributes_default()); - - options.insert = insertBySelector_default().bind(null, "head"); - -options.domAPI = (styleDomAPI_default()); -options.insertStyleElement = (insertStyleElement_default()); - -var update = injectStylesIntoStyleTag_default()(main/* default */.Z, options); - - - - - /* harmony default export */ const styles_main = (main/* default */.Z && main/* default */.Z.locals ? main/* default */.Z.locals : undefined); - -;// CONCATENATED MODULE: ./src/utils/getYTVideoData.js -async function detect(cleanText) { - const response = await fetch("https://rust-server-531j.onrender.com/detect", { - method: "POST", - body: cleanText, - }); - return await response.text(); -} - -// Get the language code from the response or the text -async function getLanguage(player, response, title, description, author) { - if (!window.location.hostname.includes("m.youtube.com")) { - // ! Experimental ! get lang from selected audio track if availabled - const audioTracks = player.getAudioTrack(); - const trackInfo = audioTracks?.getLanguageInfo(); // get selected track info (id === "und" if tracks are not available) - if (trackInfo?.id !== "und") { - return trackInfo.id.split(".")[0]; - } - } - - // TODO: If the audio tracks will work fine, transfer the receipt of captions to the audioTracks variable - // Check if there is an automatic caption track in the response - const captionTracks = - response?.captions?.playerCaptionsTracklistRenderer?.captionTracks; - if (captionTracks?.length) { - const autoCaption = captionTracks.find((caption) => caption.kind === "asr"); - if (autoCaption) { - return autoCaption.languageCode; - } - } - // If there is no caption track, use detect to get the language code from the text - const text = [title, description, author].join(" "); - // Remove anything that is not a letter or a space in any language - const cleanText = text - .replace(/https?:\/\/\S+/g, "") - .replace(/[^\p{L}\s]/gu, "") - .trim() - .slice(0, 250); - return await detect(cleanText); -} - -// Get the video data from the player -async function getYTVideoData() { - const player = document.querySelector("#movie_player"); - const data = player.getVideoData(); - const response = player.getPlayerResponse(); - const { isLive, isPremiere, title, author } = data; - const { shortDescription: description } = response?.videoDetails ?? {}; - const videoData = { - isLive, - isPremiere, - title, - description, - author, - detectedLanguage: await getLanguage( - player, - response, - title, - description, - author - ), - }; - console.log("VOT Detected language: ", videoData.detectedLanguage); - return videoData; -} - - - -// EXTERNAL MODULE: ./src/yandexRequests.js -var yandexRequests = __webpack_require__("./src/yandexRequests.js"); -;// CONCATENATED MODULE: ./src/config/constants.js -const translateFuncParam = 0x40_75_50_00_00_00_00_00; -const availableLangs = { - ru: "Russian", - en: "English", - zh: "Chinese", - fr: "French", - it: "Italian", - es: "Spanish", - de: "German", -}; // available languages for translation -const siteTranslates = { - youtube: "https://youtu.be/", - twitch: "https://twitch.tv/", - vimeo: "https://vimeo.com/", - "9gag": "https://9gag.com/gag/", - vk: "https://vk.com/video?z=", - xvideos: "https://www.xvideos.com/", - pornhub: "https://rt.pornhub.com/view_video.php?viewkey=", - udemy: "https://www.udemy.com", - twitter: "https://twitter.com/i/status/", - facebook: "https://www.facebook.com/", - rutube: "https://rutube.ru/video/", - "bilibili.com": "https://www.bilibili.com/video/", - "mail.ru": "https://my.mail.ru/", - coub: "https://coub.com/view/", -}; -const translations = { - ru: { - recommended: "рекомендуется", - translateVideo: "Перевести видео", - disableTranslate: "Выключить", - translationSettings: "Настройки перевода", - resetSettings: "Сбросить настройки", - videoBeingTranslated: "Видео переводится", - videoLanguage: "Язык видео", - translationLanguage: "Язык перевода", - translationTake: "Перевод займёт", - translationTakeMoreThanHour: "Перевод займёт больше часа", - translationTakeAboutMinute: "Перевод займёт около минуты", - translationTakeFewMinutes: "Перевод займёт несколько минут", - translationTakeApproximatelyMinutes: "Перевод займёт примерно {0} минут", - translationTakeApproximatelyMinute: "Перевод займёт примерно {0} минуты", - unSupportedExtensionError: `Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`, - requestTranslationFailed: "Не удалось запросить перевод видео", - audioNotReceived: "Не получена ссылка на аудио", - grantPermissionToAutoPlay: "Предоставьте разрешение на автовоспроизведение", - neededAdditionalExtension: - "Для поддержки этого сайта необходимо дополнительное расширение", - audioFormatNotSupported: "Формат аудио не поддерживается", - VOTAutoTranslate: "Переводить при открытии", - VOTDontTranslateYourLang: "Не переводить с родного языка", - VOTVolume: "Громкость видео", - VOTVolumeTranslation: "Громкость перевода", - VOTAutoSetVolume: "Уменьшать громкость видео до ", - VOTShowVideoSlider: "Слайдер громкости видео", - VOTSyncVolume: "Связать громкость перевода и видео", - VOTAudioProxy: "Проксировать полученное аудио", - VOTDisableFromYourLang: "VOT: Вы отключили перевод видео на вашем языке", - VOTLiveNotSupported: - "VOT: Не поддерживается перевод трансляций в прямом эфире", - VOTPremiere: "VOT: Дождитесь окончания премьеры перед переводом", - VOTVideoIsTooLong: "VOT: Видео слишком длинное", - VOTNoVideoIDFound: "VOT: Не найдено ID видео", - VOTFailedInitDB: "VOT: Не удалось инициализовать базу данных", - VOTDBNeedUpdate: - "VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу", - VOTDisabledForDBUpdating: `VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`, - VOTFailedWriteToDB: "VOT: Не удалось записать данные в базу данных", - VOTFailedReadFromDB: "VOT: Не удалось получить данные из базы данных", - Russian: "Русский", - English: "Английский", - Chinese: "Китайский", - French: "Французский", - Italian: "Итальянский", - Spanish: "Испанский", - German: "Немецкий", - }, - en: { - recommended: "recommended", - translateVideo: "Translate video", - disableTranslate: "Turn off", - translationSettings: "Translation settings", - resetSettings: "Reset settings", - videoBeingTranslated: "The video is being translated", - videoLanguage: "Video language", - translationLanguage: "Translation language", - translationTake: "The translation will take", - translationTakeMoreThanHour: "The translation will take more than an hour", - translationTakeAboutMinute: "The translation will take about a minute", - translationTakeFewMinutes: "The translation will take a few minutes", - translationTakeApproximatelyMinutes: - "The translation will take approximately {0} minutes", - translationTakeApproximatelyMinute: - "The translation will take approximately {0} minutes", - unSupportedExtensionError: `Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`, - requestTranslationFailed: "Failed to request video translation", - audioNotReceived: "Audio link not received", - grantPermissionToAutoPlay: "Grant permission to autoplay", - neededAdditionalExtension: - "An additional extension is needed to support this site", - audioFormatNotSupported: "The audio format is not supported", - VOTAutoTranslate: "Translate on open", - VOTDontTranslateYourLang: "Do not translate from my language", - VOTVolume: "Video volume", - VOTVolumeTranslation: "Translation Volume", - VOTAutoSetVolume: "Reduce video volume to ", - VOTShowVideoSlider: "Video volume slider", - VOTSyncVolume: "Link translation and video volume", - VOTAudioProxy: "Proxy received audio", - VOTDisableFromYourLang: - "VOT: You have disabled the translation of the video in your language", - VOTLiveNotSupported: "VOT: Translation of live streams is not supported", - VOTPremiere: "VOT: Wait for the premiere to end before translating", - VOTVideoIsTooLong: "VOT: Video is too long", - VOTNoVideoIDFound: "VOT: No video ID found", - VOTFailedInitDB: "VOT: Failed to initialize database", - VOTDBNeedUpdate: - "VOT: The database needs an update, please reload the page", - VOTDisabledForDBUpdating: `VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`, - VOTFailedWriteToDB: "VOT: Data could not be written to the database", - VOTFailedReadFromDB: "VOT: Data could not be retrieved from the database", - Russian: "Russian", - English: "English", - Chinese: "Chinese", - French: "French", - Italian: "Italian", - Spanish: "Spanish", - German: "German", - }, - zh: { - recommended: "推荐使用", - translateVideo: "翻译视频", - disableTranslate: "关掉", - translationSettings: "翻译需要一个多小时", - resetSettings: "重置设置", - videoBeingTranslated: "视频正在翻译中", - videoLanguage: "视频语言", - translationLanguage: "翻译语言", - translationTake: "翻译将采取", - translationTakeMoreThanHour: "翻译将采取一个多小时", - translationTakeAboutMinute: "翻译将采取一分钟", - translationTakeFewMinutes: "翻译将采取几分钟", - translationTakeApproximatelyMinutes: "翻译将采取大约需要{0}分钟", - translationTakeApproximatelyMinute: "翻译将采取大约需要{0}分钟", - unSupportedExtensionError: `错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`, - requestTranslationFailed: "请求视频翻译失败", - audioNotReceived: "未收到音频链接", - grantPermissionToAutoPlay: "授予自动播放权限", - neededAdditionalExtension: "需要一个额外的扩展来支持这个网站", - audioFormatNotSupported: "不支持音频格式", - VOTAutoTranslate: "打开时翻译", - VOTDontTranslateYourLang: "不要从你的语言翻译过来", - VOTVolume: "视频量", - VOTVolumeTranslation: "翻译量", - VOTAutoSetVolume: "将视频音量降低到", - VOTShowVideoSlider: "视频音量滑块", - VOTSyncVolume: "链接翻译和视频音量", - VOTAudioProxy: "代理接收的音频", - VOTDisableFromYourLang: "VOT:你已经禁用了你的语言的视频翻译", - VOTLiveNotSupported: "VOT:不支持直播流的翻译", - VOTPremiere: "VOT:等待首映结束后再翻译", - VOTVideoIsTooLong: "VOT:视频太长", - VOTNoVideoIDFound: "VOT: 没有找到视频ID", - VOTFailedInitDB: "VOT: 初始化数据库失败", - VOTDBNeedUpdate: "VOT: 数据库需要更新,请重新加载页面", - VOTDisabledForDBUpdating: `VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`, - VOTFailedWriteToDB: "VOT: 无法将数据写入数据库", - VOTFailedReadFromDB: "VOT: 无法从数据库中检索数据", - Russian: "俄语", - English: "英语", - Chinese: "中文", - French: "法语", - Italian: "意大利语", - Spanish: "西班牙语", - German: "德语", - }, - de: { - recommended: "es wird empfohlen", - translateVideo: "Video übersetzen", - disableTranslate: "Ausschalten", - translationSettings: "Übersetzungseinstellungen", - resetSettings: "Einstellungen zurücksetzen", - videoBeingTranslated: "Das Video wird übersetzt", - videoLanguage: "Sprache Video", - translationLanguage: "Zielsprache", - translationTake: "Die Übersetzung dauert", - translationTakeMoreThanHour: "Die Übersetzung dauert mehr als eine Stunde", - translationTakeAboutMinute: "Die Übersetzung dauert ungefähr eine Minute", - translationTakeFewMinutes: "Die Übersetzung dauert einige Minuten", - translationTakeApproximatelyMinutes: - "Die Übersetzung dauert ungefähr {0} Minuten", - translationTakeApproximatelyMinute: - "Die Übersetzung dauert ungefähr {0} Minuten", - unSupportedExtensionError: `Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`, - requestTranslationFailed: - "Videoübersetzung konnte nicht angefordert werden", - audioNotReceived: "Audiolink nicht empfangen", - grantPermissionToAutoPlay: - "Erteilen Sie die Berechtigung zur automatischen Wiedergabe", - neededAdditionalExtension: - "Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen", - audioFormatNotSupported: "Das Audioformat wird nicht unterstützt", - VOTAutoTranslate: "Beim Öffnen übersetzen", - VOTDontTranslateYourLang: "Nicht aus Ihrer Sprache übersetzen", - VOTVolume: "Video Lautstärke", - VOTVolumeTranslation: "Übersetzungsvolumen", - VOTAutoSetVolume: "Video-Lautstärke auf reduzieren ", - VOTShowVideoSlider: "Video-Lautstärkeregler", - VOTSyncVolume: "Übersetzungs- und Videolautstärke verknüpfen", - VOTAudioProxy: "Empfangenes Audio proxyen", - VOTDisableFromYourLang: - "VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert", - VOTLiveNotSupported: - "VOT: Übersetzung von Live-Streams wird nicht unterstützt", - VOTPremiere: - "VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen", - VOTVideoIsTooLong: "VOT: Video ist zu lang", - VOTNoVideoIDFound: "VOT: Keine Video-ID gefunden", - VOTFailedInitDB: "VOT: Datenbank konnte nicht initialisiert werden", - VOTDBNeedUpdate: - "VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu", - VOTDisabledForDBUpdating: `VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`, - VOTFailedWriteToDB: - "VOT: Daten konnten nicht in die Datenbank geschrieben werden", - VOTFailedReadFromDB: "VOT: Konnte keine Daten aus der Datenbank abrufen", - Russian: "Russisch", - English: "Englisch", - Chinese: "Chinesisch", - French: "Französisch", - Italian: "Italienisch", - Spanish: "Spanisch", - German: "Deutsch", - }, - es: { - recommended: "es recomendable", - translateVideo: "Traducir video", - disableTranslate: "Apagar", - translationSettings: "Ajustes de traducción", - resetSettings: "Restablecer ajustes", - videoBeingTranslated: "El video está siendo traducido", - videoLanguage: "Idioma del video", - translationLanguage: "Idioma de la traducción", - translationTake: "La traducción tardará", - translationTakeMoreThanHour: "La traducción tardará más de una hora", - translationTakeAboutMinute: - "La traducción tardará aproximadamente un minuto", - translationTakeFewMinutes: "La traducción tardará unos minutos", - translationTakeApproximatelyMinutes: - "La traducción tardará aproximadamente {0} minutos", - translationTakeApproximatelyMinute: - "La traducción tardará aproximadamente {0} minutos", - unSupportedExtensionError: `Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`, - requestTranslationFailed: "Error al solicitar la traducción de vídeo", - audioNotReceived: "Audiolink nicht empfangen", - grantPermissionToAutoPlay: "Conceder permiso de reproducción automática", - neededAdditionalExtension: - "Se necesita una extensión adicional para admitir este sitio", - audioFormatNotSupported: "El formato de audio no es compatible", - VOTAutoTranslate: "Traducir al abrir", - VOTDontTranslateYourLang: "No traduzca de su lengua", - VOTVolume: "Volumen de vídeo", - VOTVolumeTranslation: "Volumen de traducción", - VOTAutoSetVolume: "Reducir el volumen del video al ", - VOTShowVideoSlider: "Deslizador de volumen de video", - VOTSyncVolume: "Vincular el volumen de traducción y video", - VOTAudioProxy: "Proxificar el audio recibido", - VOTDisableFromYourLang: - "VOT: Ha desactivado la traducción del vídeo en su idioma", - VOTLiveNotSupported: - "VOT: No se admite la traducción de transmisiones en vivo", - VOTPremiere: "VOT: Espere a que termine el estreno antes de traducir", - VOTVideoIsTooLong: "VOT: El video es demasiado largo", - VOTNoVideoIDFound: "VOT: No se encontró id de video", - VOTFailedInitDB: "VOT: No se pudo inicializar la base de datos", - VOTDBNeedUpdate: - "VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página", - VOTDisabledForDBUpdating: `VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`, - VOTFailedWriteToDB: "VOT: No se pudo escribir datos en la base de datos", - VOTFailedReadFromDB: "VOT: No se pudo recuperar datos de la base de datos", - Russian: "Ruso", - English: "Inglés", - Chinese: "Chino", - French: "Francés", - Italian: "Italiano", - Spanish: "Español", - German: "Alemán", - }, - fr: { - recommended: "recommande", - translateVideo: "Traduire la vidéo", - disableTranslate: "Désactiver", - translationSettings: "Paramètres de traduction", - resetSettings: "Réinitialiser les paramètres", - videoBeingTranslated: "La vidéo est en cours de traduction", - videoLanguage: "Langue vidéo", - translationLanguage: "Langue cible", - translationTake: "La traduction prendra", - translationTakeMoreThanHour: "La traduction prendra plus d'une heure", - translationTakeAboutMinute: "La traduction prendra environ une minute", - translationTakeFewMinutes: "La traduction prendra quelques minutes", - translationTakeApproximatelyMinutes: - "La traduction prendra environ {0} minutes", - translationTakeApproximatelyMinute: - "La traduction prendra environ {0} minutes", - unSupportedExtensionError: `Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`, - requestTranslationFailed: - "Impossible de demander la traduction de la vidéo", - audioNotReceived: "Lien audio non reçu", - grantPermissionToAutoPlay: "Accorder l'autorisation de lecture automatique", - neededAdditionalExtension: - "Une extension supplémentaire est nécessaire pour prendre en charge ce site", - audioFormatNotSupported: "Format audio non pris en charge", - VOTAutoTranslate: "Traduire à l'ouverture", - VOTDontTranslateYourLang: "Ne pas traduire à partir de votre langue", - VOTVolume: "Volume de la vidéo", - VOTVolumeTranslation: "Volume de traduction", - VOTAutoSetVolume: "Réduire le volume de la vidéo à ", - VOTShowVideoSlider: "Curseur de volume vidéo", - VOTSyncVolume: "Lier le volume de la traduction et de la vidéo", - VOTAudioProxy: "Proxy audio reçu", - VOTDisableFromYourLang: - "VOT: Vous avez désactivé la traduction de la vidéo dans votre langue", - VOTLiveNotSupported: - "VOT: La traduction des flux en direct n'est pas prise en charge", - VOTPremiere: "VOT: Attendez la fin de la première avant de traduire", - VOTVideoIsTooLong: "VOT: La vidéo est trop longue", - VOTNoVideoIDFound: "VOT: ID vidéo introuvable", - VOTFailedInitDB: "VOT: Impossible d'initialiser la base de données", - VOTDBNeedUpdate: - "VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page", - VOTDisabledForDBUpdating: `VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`, - VOTFailedWriteToDB: - "VOT: Impossible d'écrire les données dans la base de données", - VOTFailedReadFromDB: - "VOT: Impossible de récupérer les données de la base de données", - Russian: "Russe", - English: "Anglais", - Chinese: "Chinois", - French: "Français", - Italian: "Italien", - Spanish: "Espagnol", - German: "Allemand", - }, - it: { - recommended: "è consigliabile", - translateVideo: "Traduci il video", - disableTranslate: "Spegnere", - translationSettings: "Impostazioni di traduzione", - resetSettings: "Ripristina impostazioni", - videoBeingTranslated: "Il video è in fase di traduzione", - videoLanguage: "Lingua Video", - translationLanguage: "Lingua di traduzione", - translationTake: "La traduzione richiederà", - translationTakeMoreThanHour: "La traduzione richiederà più di un'ora", - translationTakeAboutMinute: "La traduzione richiederà circa un minuto", - translationTakeFewMinutes: "La traduzione richiederà alcuni minuti", - translationTakeApproximatelyMinutes: - "La traduzione richiederà circa {0} minuti", - translationTakeApproximatelyMinute: - "La traduzione richiederà circa {0} minuti", - unSupportedExtensionError: `Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`, - requestTranslationFailed: "Richiesta di traduzione video non riuscita", - audioNotReceived: "Collegamento audio non ricevuto", - grantPermissionToAutoPlay: - "Concedere l'Autorizzazione per la riproduzione automatica", - neededAdditionalExtension: - "Per supportare questo sito è necessaria un'estensione aggiuntiva", - audioFormatNotSupported: "Il formato audio non è supportato", - VOTAutoTranslate: "Traduci all'apertura", - VOTDontTranslateYourLang: "Non traducete dalla vostra lingua", - VOTVolume: "Volume video", - VOTVolumeTranslation: "Volume di traduzione", - VOTAutoSetVolume: "Riduci il volume del video al ", - VOTShowVideoSlider: "Cursore del volume del video", - VOTSyncVolume: "Collega il volume della traduzione e del video", - VOTAudioProxy: "Proxy audio ricevuto", - VOTDisableFromYourLang: - "VOT: Avete disabilitato la traduzione del video nella vostra lingua", - VOTLiveNotSupported: - "VOT: La traduzione dei flussi dal vivo non è supportata", - VOTPremiere: "VOT: Aspetta che la prima finisca prima di tradurre", - VOTVideoIsTooLong: "VOT: Il video è troppo lungo", - VOTNoVideoIDFound: "VOT: ID video non trovato", - VOTFailedInitDB: "VOT: Impossibile inizializzare il database", - VOTDBNeedUpdate: - "VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina", - VOTDisabledForDBUpdating: `VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`, - VOTFailedWriteToDB: "VOT: Impossibile scrivere dati nel database", - VOTFailedReadFromDB: "VOT: Impossibile recuperare i dati dal database", - Russian: "Russo", - English: "Inglese", - Chinese: "Cinese", - French: "Francese", - Italian: "Italiano", - Spanish: "Spagnolo", - German: "Tedesco", - }, -}; - - - -;// CONCATENATED MODULE: ./src/utils/debug.js - - -const debug = {}; -debug.log = (...text) => { - if (true) { - return; - } - return console.log( - "%c[VOT DEBUG]", - "background: #F2452D; color: #fff; padding: 5px;", - ...text - ); -}; - -debug.translations = (testLang) => { - if (true) { - return; - } - // for add indexes - const testedTranslations = Object.entries(translations[testLang]).map( - ([key, value]) => ({ - phrase: key, - translated: value, - }) - ); - testedTranslations.unshift({ - phrase: "language_code (debug only)", - translated: testLang, - }); - return console.table(testedTranslations); -}; - -/* harmony default export */ const utils_debug = (debug); - -;// CONCATENATED MODULE: ./src/menu.js - - - -const userlang = navigator.language || navigator.userLanguage; -let lang = userlang.substr(0, 2).toLowerCase(); -if (!(lang in translations)) { - lang = "en"; -} - -function changeBtnColor(n) { - document.querySelector(".translationBtn").style.color = n; -} - -function changeBtnState(newState = "none") { - document.querySelector(".translationBtn").dataset.state = newState; -} - -function changeIconBackground(type = "none") { - let iconBackgroundColor; - switch (type) { - case "error": - iconBackgroundColor = "#7A7A7D"; - break; - case "success": - iconBackgroundColor = "#A36EFF"; - break; - default: - iconBackgroundColor = "#FFFFFF"; - break; - } - - document.querySelector(".translateIcon").style.fill = iconBackgroundColor; -} - -function transformBtn(type = "none", text) { - switch (type) { - case "error": - changeIconBackground(type); - changeBtnColor("#7A7A7D"); - changeBtnState(type); - break; - case "success": - changeIconBackground(type); - changeBtnColor("#A36EFF"); - changeBtnState(type); - break; - default: - changeIconBackground("none"); - changeBtnColor("#FFFFFF"); - changeBtnState("none"); - break; - } - - document.querySelector(".translationBtn").innerText = text; -} - -// Add translation buttton block -function addTranslationBlock(element) { - if (!element || element.querySelector(".translationBlock")) return; - - const block = document.createElement("div"); - block.classList.add("translationBlock"); - block.innerHTML = ` - - - - - - - ${translations[lang].translateVideo} - - - - - - - `; - - element.appendChild(block); - utils_debug.log("VOT: Added translation button to ", element); -} - -function createTranslationMenu() { - const container = document.createElement("div"); - container.classList.add("translationMenuContent"); - container.innerHTML = ` -

${translations[lang].translationSettings}

-
-
- - - - - - -
- `; - - container.onclick = (event) => event.stopPropagation(); - return container; -} - -// Create checkbox for menu -function createMenuCheckbox(id, valueToCheck, content) { - const checkboxContainer = document.createElement("div"); - const checkbox = document.createElement("input"); - const checkboxLabel = document.createElement("label"); - - checkbox.type = "checkbox"; - checkbox.id = id; - checkbox.checked = Boolean(valueToCheck); - - checkboxLabel.htmlFor = id; - checkboxLabel.innerHTML = content; - - checkboxContainer.classList.add("translationMenuContainer"); - checkboxContainer.appendChild(checkbox); - checkboxContainer.appendChild(checkboxLabel); - - return checkboxContainer; -} - -// Create slider for menu -function createMenuSlider(id, sliderValue, content) { - const sliderContainer = document.createElement("div"); - const slider = document.createElement("input"); - const sliderLabel = document.createElement("label"); - - slider.type = "range"; - slider.id = id; - slider.classList.add("VOTMenuSlider"); - slider.min = 0; - slider.max = 100; - slider.value = sliderValue; - - sliderLabel.htmlFor = id; - sliderLabel.classList.add("translationHeader"); - sliderLabel.innerHTML = content; - - sliderContainer.classList.add("translationMenuContainer"); - sliderContainer.appendChild(sliderLabel); - sliderContainer.appendChild(slider); - - return sliderContainer; -} - -// Create select for menu -function createMenuSelect(id, selectOptions) { - // selectOptions structure: - // [ - // { - // label: string, - // value: string, - // selected: boolean, - // disabled: boolean - // } - // ] - const selectContainer = document.createElement("div"); - const select = document.createElement("select"); - - select.id = id; - select.classList.add("VOTMenuSelect"); - - for (const option of selectOptions) { - const optionElement = document.createElement("option"); - optionElement.innerText = option.label; - optionElement.value = option.value; - if ( - Object.prototype.hasOwnProperty.call(option, "selected") && - option.selected - ) { - optionElement.setAttribute("selected", "selected"); - } - - if (Object.prototype.hasOwnProperty.call(option, "disabled")) { - optionElement.disabled = option.disabled; - } - - select.appendChild(optionElement); - } - - selectContainer.classList.add("translationMenuContainer"); - selectContainer.appendChild(select); - - return selectContainer; -} - - - -;// CONCATENATED MODULE: ./src/utils/utils.js - - - -if (!String.prototype.format) { - // https://stackoverflow.com/questions/610406/javascript-equivalent-to-printf-string-format - // syntax example: "is {0} function".format("format") - String.prototype.format = function () { - // store arguments in an array - var args = arguments; - // use replace to iterate over the string - // select the match and check if the related argument is present - // if yes, replace the match with the argument - return this.replace(/{(\d+)}/g, function (match, index) { - // check if the argument is present - return typeof args[index] != "undefined" ? args[index] : match; - }); - }; -} - -function waitForElm(selector) { - // https://stackoverflow.com/questions/5525071/how-to-wait-until-an-element-exists - return new Promise((resolve) => { - const element = document.querySelector(selector); - if (element) { - return resolve(element); - } - - const observer = new MutationObserver(() => { - const element = document.querySelector(selector); - if (element) { - resolve(element); - observer.disconnect(); - } - }); - - observer.observe(document.body, { - childList: true, - subtree: true, - once: true, - }); - }); -} - -const sleep = (m) => new Promise((r) => setTimeout(r, m)); - -const getVideoId = (service) => { - const url = new URL(window.location.href); - - switch (service) { - case "youtube": - return ( - url.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1] || - url.searchParams.get("v") - ); - case "vk": - if (url.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)) { - return url.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1); - } else if (url.searchParams.get("z")) { - return url.searchParams.get("z").split("/")[0]; - } else if (url.searchParams.get("oid") && url.searchParams.get("id")) { - return `video-${Math.abs( - url.searchParams.get("oid") - )}_${url.searchParams.get("id")}`; - } else { - return false; - } - case "9gag": - case "gag": - return url.pathname.match(/gag\/([^/]+)/)?.[1]; - case "twitch": - if (/^m\.twitch\.tv$/.test(window.location.hostname)) { - const linkUrl = document.head.querySelector('link[rel="canonical"]'); - return ( - linkUrl?.href.match(/videos\/([^/]+)/)?.[0] || url.pathname.slice(1) - ); - } else if (/^player\.twitch\.tv$/.test(window.location.hostname)) { - return `videos/${url.searchParams.get("video")}`; - } else if (/^clips\.twitch\.tv$/.test(window.location.hostname)) { - // get link to twitch channel (ex.: https://www.twitch.tv/xqc) - const channelLink = document.querySelector( - ".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']" - ); - if (!channelLink) { - return false; - } - - const channelName = channelLink.href.replace( - "https://www.twitch.tv/", - "" - ); - return `${channelName}/clip/${url.searchParams.get("clip")}`; - } else if (url.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)) { - return url.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]; - } else { - return url.pathname.match(/(?:videos)\/([^/]+)/)?.[0]; - } - case "tiktok": - return url.pathname.match(/video\/([^/]+)/)?.[1]; - case "vimeo": - return ( - url.pathname.match(/[^/]+\/[^/]+$/)?.[0] || - url.pathname.match(/[^/]+$/)?.[0] - ); - case "xvideos": - return url.pathname.match(/[^/]+\/[^/]+$/)?.[0]; - case "pornhub": - return ( - url.searchParams.get("viewkey") || - url.pathname.match(/embed\/([^/]+)/)?.[1] - ); - case "twitter": - return url.pathname.match(/status\/([^/]+)/)?.[1]; - case "udemy": - return url.pathname; - case "facebook": - return url.pathname; - case "rutube": - return url.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1]; - case "coub": - return url.pathname.match(/view\/([^/]+)/)?.[1]; - case "bilibili.com": - const bvid = url.searchParams.get("bvid"); - if (bvid) { - return bvid; - } else { - let vid = url.pathname.match(/video\/([^/]+)/)?.[1]; - if (vid && url.search && url.searchParams.get("p") !== null) { - vid += `/?p=${url.searchParams.get("p")}`; - } - return vid; - } - case "mail.ru": - if (url.pathname.startsWith("/v/") || url.pathname.startsWith("/mail/")) { - return url.pathname; - } else if (url.pathname.match(/video\/embed\/([^/]+)/)) { - const referer = document.querySelector( - ".b-video-controls__mymail-link" - ); - if (!referer) { - return false; - } - - return referer?.href.split("my.mail.ru")?.[1]; - } - default: - return false; - } -}; - -function secsToStrTime(secs) { - const minutes = Math.floor(secs / 60); - const seconds = Math.floor(secs % 60); - if (minutes >= 60) { - return translations[lang].translationTakeMoreThanHour; - } else if (minutes >= 10 && minutes % 10) { - return translations[lang].translationTakeApproximatelyMinutes.format( - minutes - ); - } else if (minutes == 1 || (minutes == 0 && seconds > 0)) { - return translations[lang].translationTakeAboutMinute; - } else { - return translations[lang].translationTakeApproximatelyMinute.format( - minutes - ); - } -} - - - -// EXTERNAL MODULE: ./src/config/config.js -var config = __webpack_require__("./src/config/config.js"); -;// CONCATENATED MODULE: ./src/config/alternativeUrls.js -// Sites host Invidious. I tested the performance only on invidious.kevin.rocks, youtu.be and inv.vern.cc -const sitesInvidious = [ - "invidious.snopyta.org", - "yewtu.be", - "invidious.kavin.rocks", - "vid.puffyan.us", - "invidious.namazso.eu", - "inv.riverside.rocks", - "yt.artemislena.eu", - "invidious.flokinet.to", - "invidious.esmailelbob.xyz", - "y.com.sb", - "invidious.nerdvpn.de", - "inv.vern.cc", - "invidious.slipfox.xyz", - "invidio.xamh.de", - "invidious.dhusch.de", -]; - -// Sites host Piped. I tested the performance only on piped.video -const sitesPiped = [ - "piped.video", - "piped.tokhmi.xyz", - "piped.moomoo.me", - "piped.syncpundit.io", - "piped.mha.fi", - "watch.whatever.social", - "piped.garudalinux.org", - "efy.piped.pages.dev", - "watch.leptons.xyz", - "piped.lunar.icu", - "yt.dc09.ru", - "piped.mint.lgbt", - "il.ax", - "piped.privacy.com.de", - "piped.esmailelbob.xyz", - "piped.projectsegfau.lt", - "piped.in.projectsegfau.lt", - "piped.us.projectsegfau.lt", - "piped.privacydev.net", - "piped.palveluntarjoaja.eu", - "piped.smnz.de", - "piped.adminforge.de", - "piped.qdi.fi", - "piped.hostux.net", - "piped.chauvet.pro", - "piped.jotoma.de", - "piped.pfcd.me", - "piped.frontendfriendly.xyz", -]; - - - -;// CONCATENATED MODULE: ./src/indexedDB.js - - - -// --- IndexedDB functions start: -const dbVersion = 2; // current db version -const settingsDefault = { - key: "settings", - autoTranslate: 0, - defaultVolume: 100, - showVideoSlider: 0, - syncVolume: 0, - autoSetVolumeYandexStyle: 1, - dontTranslateYourLang: 1, -}; // default settings for db v1 - -const valuesV2 = { - audioProxy: 0, -}; - -function openDB(name) { - return indexedDB.open(name, dbVersion); -} - -async function initDB() { - return new Promise((resolve, reject) => { - function updateVersionProccessor( - transaction, - db, - indexes, - previousIndexes = {} - ) { - // openRequest is transaction object - // indexes is object of strings with default values (used for createIndex) ex. {"name": 0} - // previousIndexes is indexes for previous version - const objectStore = transaction.objectStore("settings"); - - for (const key of Object.keys(indexes)) { - objectStore.createIndex(key, key, { unique: false }); - } - - console.log("VOT: The database has been updated"); - objectStore.transaction.oncomplete = (event) => { - const objectStore = db - .transaction("settings", "readwrite") - .objectStore("settings"); - const request = objectStore.get("settings"); - - request.onerror = (event) => { - console.error( - "VOT: Data could not be retrieved from the Database: ", - event.error - ); - reject(false); - }; - - request.onsuccess = () => { - const data = - request.result || Object.assign(settingsDefault, previousIndexes); // use data from db or reset all data - for (const key in indexes) { - data[key] = indexes[key]; - } - - const requestUpdate = objectStore.put(data); - - requestUpdate.onerror = (event) => { - console.error( - "VOT: Failed to update the Database to new version", - event.error - ); - reject(false); - }; - - requestUpdate.onsuccess = () => { - console.log( - "VOT: Standard settings of the new version have been added to the Database." - ); - resolve(true); - }; - }; - }; - } - - const openRequest = openDB("VOT"); - - openRequest.onerror = () => { - console.error( - `${translations[lang].VOTFailedInitDB}: ${openRequest.error.message}` - ); - reject(false); - }; - - openRequest.onupgradeneeded = (event) => { - const db = openRequest.result; - - db.onerror = () => { - const errorMessage = translations[lang].VOTFailedInitDB; - alert(errorMessage); - console.error(errorMessage, openRequest.error); - reject(false); - }; - - if (event.oldVersion < 1) { - // db not found - const objectStore = db.createObjectStore("settings", { - keyPath: "key", - }); - - // add indexes for 1 version (without key index) - for (const key of Object.keys(settingsDefault).filter( - (k) => k !== "key" - )) { - objectStore.createIndex(key, key, { unique: false }); - } - - console.log("VOT: Database Created"); - - objectStore.transaction.oncomplete = (event) => { - const objectStore = db - .transaction("settings", "readwrite") - .objectStore("settings"); - const request = objectStore.add(settingsDefault); - - request.onsuccess = () => { - console.log( - "VOT: Standard settings added to the Database: ", - request.result - ); - resolve(true); - }; - - request.onerror = () => { - console.log( - "VOT: Error when adding standard settings to the Database: ", - request.error - ); - reject(false); - }; - }; - } - - if (event.oldVersion < 2) { - // db is outdated (db version is 1) - updateVersionProccessor(openRequest.transaction, db, valuesV2); - } - }; - - openRequest.onsuccess = () => { - const db = openRequest.result; - db.onversionchange = () => { - db.close(); - const errorMessage = translations[lang].VOTDBNeedUpdate; - alert(errorMessage); - console.log(errorMessage); - window.location.reload(); - reject(false); - }; - resolve(true); - }; - - openRequest.onblocked = () => { - const db = openRequest.result; - const errorMessage = translations[lang].VOTDisabledForDBUpdating; - console.error(errorMessage, db); - alert(errorMessage); - reject(false); - }; - }); -} - -async function updateDB({ - autoTranslate, - defaultVolume, - showVideoSlider, - syncVolume, - autoSetVolumeYandexStyle, - dontTranslateYourLang, - audioProxy, -}) { - return new Promise((resolve, reject) => { - if ( - typeof autoTranslate === "number" || - typeof defaultVolume === "number" || - typeof showVideoSlider === "number" || - typeof syncVolume === "number" || - typeof autoSetVolumeYandexStyle === "number" || - typeof dontTranslateYourLang === "number" || - typeof audioProxy === "number" - ) { - const openRequest = openDB("VOT"); - - openRequest.onerror = () => { - const errorMessage = translations[lang].VOTFailedWriteToDB; - alert(errorMessage); - console.error(errorMessage, openRequest.error.message); - reject(false); - }; - - openRequest.onupgradeneeded = async () => { - const db = openRequest.result; - db.close(); - await initDB(); - resolve(true); - }; - - openRequest.onsuccess = () => { - const db = openRequest.result; - db.onversionchange = () => { - db.close(); - console.log( - "VOT: The database needs an update, please reload the page if it didn't happen automatically" - ); - window.location.reload(); - reject(false); - }; - - const objectStore = db - .transaction("settings", "readwrite") - .objectStore("settings"); - const request = objectStore.get("settings"); - - request.onerror = (event) => { - console.error( - "VOT: Data could not be retrieved from the Database: ", - event.error - ); - reject(false); - }; - - request.onsuccess = () => { - const data = request.result; - - if (typeof autoTranslate === "number") { - data.autoTranslate = autoTranslate; - } - - if (typeof defaultVolume === "number") { - data.defaultVolume = defaultVolume; - } - - if (typeof showVideoSlider === "number") { - data.showVideoSlider = showVideoSlider; - } - - if (typeof syncVolume === "number") { - data.syncVolume = syncVolume; - } - - if (typeof autoSetVolumeYandexStyle === "number") { - data.autoSetVolumeYandexStyle = autoSetVolumeYandexStyle; - } - - if (typeof dontTranslateYourLang === "number") { - data.dontTranslateYourLang = dontTranslateYourLang; - } - - if (typeof audioProxy === "number") { - data.audioProxy = audioProxy; - } - - const requestUpdate = objectStore.put(data); - - requestUpdate.onerror = (event) => { - console.error( - "VOT: Не удалось обновить данные в Базе Данных: ", - event.error - ); - reject(false); - }; - - requestUpdate.onsuccess = () => { - resolve(true); - }; - }; - }; - - openRequest.onblocked = () => { - const db = openRequest.result; - const errorMessage = translations[lang].VOTDisabledForDBUpdating; - console.error(errorMessage, db); - alert(errorMessage); - reject(false); - }; - } - }); -} - -async function readDB() { - return new Promise((resolve, reject) => { - const openRequest = openDB("VOT"); - - openRequest.onerror = () => { - const errorMessage = translations[lang].VOTFailedReadFromDB; - alert(errorMessage); - console.error(errorMessage, openRequest.error.message); - reject(false); - }; - - openRequest.onupgradeneeded = async () => { - const db = openRequest.result; - db.close(); - await initDB(); - resolve(true); - }; - - openRequest.onsuccess = () => { - const db = openRequest.result; - db.onversionchange = () => { - db.close(); - const errorMessage = translations[lang].VOTDBNeedUpdate; - alert(errorMessage); - console.error(errorMessage); - reject(false); - }; - - const objectStore = db.transaction("settings").objectStore("settings"); - const request = objectStore.get("settings"); - - request.onerror = (event) => { - console.error(translations[lang].VOTFailedReadFromDB, event.error); - console.error(event); - reject(false); - }; - - request.onsuccess = () => { - if (request.result === undefined) { - db.close(); - deleteDB(); - reject(false); - } - const data = request.result; - resolve(data); - }; - }; - - openRequest.onblocked = () => { - const db = openRequest.result; - const errorMessage = translations[lang].VOTDisabledForDBUpdating; - console.error(errorMessage, db); - alert(errorMessage); - reject(false); - }; - }); -} - -function deleteDB() { - indexedDB.deleteDatabase("VOT"); -} - - - -;// CONCATENATED MODULE: ./src/utils/volume.js -// element - audio / video element -function syncVolume(element, sliderVolume, otherSliderVolume, tempVolume) { - let finalValue; - if (sliderVolume > tempVolume) { - // sliderVolume = 100 - // tempVolume = 69 - // volume = 15 - // 100 - 69 = 31 - // 15 + 31 = 46 - final video volume - finalValue = otherSliderVolume + (sliderVolume - tempVolume); - finalValue = finalValue > 100 ? 100 : Math.max(finalValue, 0); - - element.volume = finalValue / 100; - } else if (sliderVolume < tempVolume) { - // sliderVolume = 69 - // tempVolume = 100 - // volume = 15 - // 100 - 69 = 31 - // 15 - 31 = 0 - final video volume - finalValue = otherSliderVolume - (tempVolume - sliderVolume); - finalValue = finalValue > 100 ? 100 : Math.max(finalValue, 0); - - element.volume = finalValue / 100; - } - - return finalValue; -} - - - -;// CONCATENATED MODULE: ./src/config/regexes.js -const regexes = () => { - return { - youtubeRegex: /^(www.|m.)?youtube(-nocookie)?.com$/, - }; -}; - -/* harmony default export */ const config_regexes = (regexes()); - -;// CONCATENATED MODULE: ./src/config/selectors.js -const selectors = () => { - return { - youtubeSelector: ".html5-video-container", - twitchSelector: ".video-ref", - twitchMobileSelector: "main > div > section > div > div > div", - pipedSelector: ".shaka-video-container", - vkSelector: ".videoplayer_media", - twitterSelector: - 'div[data-testid="videoComponent"] > div:nth-child(1) > div', - vimeoSelector: ".player", - gagSelector: ".video-post", - bilibilicomSelector: ".bpx-player-video-wrap", - mailSelector: "#b-video-wrapper", - }; -}; - -/* harmony default export */ const config_selectors = (selectors()); - -;// CONCATENATED MODULE: ./src/index.js - - - - - - - - - - - - - - - -const sitesChromiumBlocked = [...sitesInvidious, ...sitesPiped]; - -// translate properties -let translateFromLang = "en"; // default language of video - -let translateToLang = "ru"; // default language of audio response - -let ytData = ""; - -async function src_main() { - utils_debug.log("Loading extension..."); - utils_debug.log(`Selected menu language: ${lang}`); - // test all translations in console - // debug.translations('ru'); - // debug.translations('en'); - // debug.translations('de'); - // debug.translations('zh'); - // debug.translations('es'); - // debug.translations('fr'); - // debug.translations('it'); - - const rvt = await Promise.resolve(/* import() */).then(__webpack_require__.bind(__webpack_require__, "./src/rvt.js")); - - const requestVideoTranslation = rvt.default; - - utils_debug.log("Inited requestVideoTranslation..."); - - if ( - true && - GM_info?.scriptHandler && - ["Violentmonkey", "FireMonkey", "Greasemonkey", "AdGuard"].includes( - GM_info.scriptHandler - ) - ) { - const errorText = translations[lang].unSupportedExtensionError; - console.error(errorText); - return alert(errorText); - } - - utils_debug.log("Extension compatibility passed..."); - - let timer; - const audio = new Audio(); - let opacityRatio = 0.9; - let openedMenu = false; - - if (false) { var translationPanding; } - - function logout(n) { - if (openedMenu) return; - - document.querySelector(".translationBlock").style.opacity = n; - } - - function resetTimer() { - clearTimeout(timer); - logout(1); - timer = setTimeout(() => { - logout(0); - }, 2000); - } - - function changeOpacityOnEvent(event, timer, opacityRatio) { - clearTimeout(timer); - logout(opacityRatio); - event.stopPropagation(); - } - - const deleteAudioSrc = () => { - audio.src = ""; - audio.removeAttribute("src"); - }; - - // Add menu container - function addTranslationMenu(element) { - if (element.querySelector(".translationMenuContent")) return; - - const container = createTranslationMenu(); - element.appendChild(container); - - // click to translation menu icon - document - .querySelector(".translationMenu") - ?.addEventListener("click", (event) => { - event.stopPropagation(); - const content = document.querySelector(".translationMenuContent"); - content.style.display = openedMenu ? "none" : "block"; - content.style.opacity = opacityRatio; - openedMenu = !openedMenu; - }); - - document - .querySelector(".translationDropDB") - .addEventListener("click", (event) => { - event.stopPropagation(); - deleteDB(); - location.reload(); - }); - - utils_debug.log("VOT: Added translation menu to ", element); - } - - function translateVideo(url, unknown1, requestLang, responseLang, callback) { - utils_debug.log( - `Translate video (url: ${url}, unknown1: ${unknown1}, requestLang: ${requestLang}, responseLang: ${responseLang})` - ); - - if (false) {} - - translationPanding = true; - - requestVideoTranslation( - url, - unknown1, - requestLang, - responseLang, - (success, response) => { - translationPanding = false; - - utils_debug.log("[exec callback] Requesting video translation"); - if (!success) { - callback(false, translations[lang].requestTranslationFailed); - return; - } - - const translateResponse = yandexRequests/* yandexRequests */.G.decodeResponse(response); - console.log("VOT Response: ", translateResponse); - - switch (translateResponse.status) { - case 0: - callback(false, translateResponse.message); - break; - case 1: - callback( - !!translateResponse.url, - translateResponse.url || translations[lang].audioNotReceived - ); - break; - case 2: - callback( - false, - translateResponse.remainingTime - ? secsToStrTime(translateResponse.remainingTime) - : translations[lang].translationTakeFewMinutes - ); - break; - case 3: - /* - Иногда, в ответе приходит статус код 3, но видео всё, так же, ожидает перевода. В конечном итоге, это занимает слишком много времени, - как-будто сервер не понимает, что данное видео уже недавно было переведено и заместо возвращения готовой ссылки на перевод начинает переводить видео заново при чём у него это получается за очень длительное время - */ - callback(false, translations[lang].videoBeingTranslated); - break; - } - } - ); - } - - async function translateProccessor(videoContainer, siteHostname, siteEvent) { - utils_debug.log("[translateProccessor] execute on element: ", videoContainer); - - let video; - let autoRetry; - let volumeOnStart; - let tempOriginalVolume; - let tempVolume; - let dbAutoTranslate; - let dbDefaultVolume; - let dbShowVideoSlider; - let dbAutoSetVolumeYandexStyle; - let dontTranslateYourLang; - let dbSyncVolume; - let dbAudioProxy; // cf version only - let firstPlay = true; - let isDBInited; - - utils_debug.log("videoContainer", videoContainer); - - video = - siteHostname === "vimeo" - ? videoContainer.querySelector( - ".vp-video-wrapper > .vp-video > .vp-telecine > video" - ) - : videoContainer.querySelector("video"); - - utils_debug.log("video", video); - - let videoData = await getVideoData(); - console.log("VOT Video Data: ", videoData); - - const container = - siteHostname === "pornhub" && - window.location.pathname.includes("view_video.php") - ? document.querySelector(".original.mainPlayerDiv") - : siteHostname === "pornhub" && - window.location.pathname.includes("embed/") - ? document.querySelector("body") - : window.location.hostname.includes("m.youtube.com") - ? document.querySelector("#player-control-container") - : videoContainer; - - addTranslationBlock(container); - addTranslationMenu(container); - - try { - isDBInited = await initDB(); - } catch (err) { - console.error( - "[VOT] Failed to initialize database settings. All changes made will not be saved", - err - ); - } - - const menuOptions = document.querySelector(".translationMenuOptions"); - if (menuOptions && !menuOptions.querySelector("#VOTTranslateFromLang")) { - const selectFromLangOptions = [ - { - label: translations[lang].videoLanguage, - value: "default", - disabled: true, - }, - ...Object.entries(availableLangs).map(([key, value]) => ({ - label: translations[lang][value], - value: key, - selected: videoData.detectedLanguage === key, - })), - ]; - - const selectToLangOptions = [ - { - label: translations[lang].translationLanguage, - value: "default", - disabled: true, - }, - ...Object.entries(availableLangs).map(([key, value]) => ({ - label: translations[lang][value], - value: key, - selected: videoData.responseLanguage === key, - })), - ]; - - const selectFromLang = createMenuSelect( - "VOTTranslateFromLang", - selectFromLangOptions - ); - - const selectToLang = createMenuSelect( - "VOTTranslateToLang", - selectToLangOptions - ).firstElementChild; - - selectFromLang.id = "VOTSelectLanguages"; - selectFromLang.innerHTML += ` - - - - `; - - selectFromLang.appendChild(selectToLang); - menuOptions.appendChild(selectFromLang); - - menuOptions - .querySelector("#VOTTranslateFromLang") - .addEventListener("change", async (event) => { - utils_debug.log("[onchange] select from language", event.target.value); - videoData = await setDetectedLangauge(videoData, event.target.value); - }); - - menuOptions - .querySelector("#VOTTranslateToLang") - .addEventListener("change", async (event) => { - utils_debug.log("[onchange] select to language", event.target.value); - videoData = await setResponseLangauge(videoData, event.target.value); - }); - } - - if (isDBInited) { - const dbData = await readDB(); - if (dbData) { - dbAutoTranslate = dbData.autoTranslate; - dbDefaultVolume = dbData.defaultVolume; - dbShowVideoSlider = dbData.showVideoSlider; - dbAutoSetVolumeYandexStyle = dbData.autoSetVolumeYandexStyle; - dontTranslateYourLang = dbData.dontTranslateYourLang; - dbAudioProxy = dbData.audioProxy; // cf version only - dbSyncVolume = dbData.syncVolume; // youtube only - - utils_debug.log("[db] data from db: ", dbData); - - if ( - dbAutoTranslate !== undefined && - menuOptions && - !menuOptions.querySelector("#VOTAutoTranslate") - ) { - const checkbox = createMenuCheckbox( - "VOTAutoTranslate", - dbAutoTranslate, - translations[lang].VOTAutoTranslate + - (siteHostname === "vk" || - window.location.hostname.includes("m.twitch.tv") - ? ` (${translations[lang].recommended})` - : "") - ); - - checkbox.querySelector("#VOTAutoTranslate").onclick = async ( - event - ) => { - event.stopPropagation(); - const value = Number(event.target.checked); - await updateDB({ autoTranslate: value }); - dbAutoTranslate = value; - utils_debug.log( - "autoTranslate value changed. New value: ", - dbAutoTranslate - ); - }; - - menuOptions.appendChild(checkbox); - } - - if ( - window.location.hostname.includes("youtube.com") && - dontTranslateYourLang !== undefined && - menuOptions && - !menuOptions.querySelector("#VOTDontTranslateYourLang") - ) { - const checkbox = createMenuCheckbox( - "VOTDontTranslateYourLang", - dontTranslateYourLang, - translations[lang].VOTDontTranslateYourLang - ); - - checkbox.querySelector("#VOTDontTranslateYourLang").onclick = async ( - event - ) => { - event.stopPropagation(); - const value = Number(event.target.checked); - await updateDB({ dontTranslateYourLang: value }); - dontTranslateYourLang = value; - utils_debug.log( - "dontTranslateYourLang value changed. New value: ", - dontTranslateYourLang - ); - }; - - menuOptions.appendChild(checkbox); - } - - if ( - dbAutoSetVolumeYandexStyle !== undefined && - menuOptions && - !menuOptions.querySelector("#VOTAutoSetVolume") - ) { - const checkbox = createMenuCheckbox( - "VOTAutoSetVolume", - dbAutoSetVolumeYandexStyle, - translations[lang].VOTAutoSetVolume + `${config/* autoVolume */.IM * 100}%` - ); - - checkbox.querySelector("#VOTAutoSetVolume").onclick = async ( - event - ) => { - event.stopPropagation(); - const value = Number(event.target.checked); - await updateDB({ autoSetVolumeYandexStyle: value }); - dbAutoSetVolumeYandexStyle = value; - utils_debug.log( - "autoSetVolumeYandexStyle value changed. New value: ", - dbAutoSetVolumeYandexStyle - ); - }; - - menuOptions.appendChild(checkbox); - } - - if ( - dbShowVideoSlider !== undefined && - menuOptions && - !menuOptions.querySelector("#VOTShowVideoSlider") - ) { - const checkbox = createMenuCheckbox( - "VOTShowVideoSlider", - dbShowVideoSlider, - translations[lang].VOTShowVideoSlider - ); - - checkbox.querySelector("#VOTShowVideoSlider").onclick = async ( - event - ) => { - event.stopPropagation(); - const value = Number(event.target.checked); - await updateDB({ showVideoSlider: value }); - dbShowVideoSlider = value; - utils_debug.log( - "showVideoSlider value changed. New value: ", - dbShowVideoSlider - ); - if ( - dbShowVideoSlider === 1 && - document.querySelector(".translationBtn").dataset.state === - "success" - ) { - addVideoSlider(); - } else { - document.querySelector("#VOTVideoSlider")?.parentElement.remove(); - } - }; - - menuOptions.appendChild(checkbox); - } - - if ( - window.location.hostname.includes("youtube.com") && - !window.location.hostname.includes("m.youtube.com") && - dbSyncVolume !== undefined && - menuOptions && - !menuOptions.querySelector("#VOTSyncVolume") - ) { - const checkbox = createMenuCheckbox( - "VOTSyncVolume", - dbSyncVolume, - translations[lang].VOTSyncVolume - ); - - checkbox.querySelector("#VOTSyncVolume").onclick = async (event) => { - event.stopPropagation(); - const value = Number(event.target.checked); - await updateDB({ syncVolume: value }); - dbSyncVolume = value; - utils_debug.log("syncVolume value changed. New value: ", dbSyncVolume); - }; - - menuOptions.appendChild(checkbox); - } - - // cf version only - if ( - false - ) {} - } - } - - transformBtn("none", translations[lang].translateVideo); - - if ( - window.location.hostname.includes("youtube.com") && - !window.location.hostname.includes("m.youtube.com") - ) { - const syncVolumeObserver = new MutationObserver(async function ( - mutations - ) { - mutations.forEach(async function (mutation) { - if ( - mutation.type === "attributes" && - mutation.attributeName === "aria-valuenow" && - document.querySelector("#VOTVideoSlider") - ) { - syncVideoVolumeSlider(); - } - }); - }); - - syncVolumeObserver.observe(document.querySelector(".ytp-volume-panel"), { - attributes: true, - childList: false, - subtree: true, - attributeOldValue: true, - }); - } - - function setSelectMenuValues(from, to = lang) { - if (!document.querySelector("#VOTSelectLanguages")) { - return; - } - console.log(`Set translation from ${from} to ${to}`); - document.querySelector("#VOTTranslateFromLang").value = from; - document.querySelector("#VOTTranslateToLang").value = to; - } - - // data - ytData or VideoData - async function setDetectedLangauge(data, videolang) { - switch (videolang) { - case "en": - data.detectedLanguage = videolang; - data.responseLanguage = lang; - break; - case "ru": - data.detectedLanguage = videolang; - data.responseLanguage = lang; - if (lang == "ru") data.responseLanguage = "en"; - break; - default: - if (!Object.keys(availableLangs).includes(videolang)) { - return setDetectedLangauge(data, "en"); - } - - data.detectedLanguage = videolang; - } - - setSelectMenuValues(data.detectedLanguage, data.responseLanguage); - - return data; - } - - // data - ytData or VideoData - async function setResponseLangauge(data, videolang) { - switch (videolang) { - case "en": - data.responseLanguage = videolang; - data.detectedLanguage = "ru"; - break; - default: - if (!Object.keys(availableLangs).includes(videolang)) { - return setResponseLangauge(data, "ru"); - } - - if (data.detectedLanguage && data.responseLanguage === lang) { - data.detectedLanguage = "en"; - } - - data.responseLanguage = videolang; - } - - setSelectMenuValues(data.detectedLanguage, data.responseLanguage); - - return data; - } - - function stopTraslate() { - // Default actions on stop translate - audio.pause(); - video.removeEventListener(".translate", stopTraslate, false); - deleteAudioSrc(); - document.querySelector("#VOTVideoSlider")?.parentElement.remove(); - document.querySelector("#VOTTranslationSlider")?.parentElement.remove(); - const downloadBtn = document.querySelector(".translationDownload"); - downloadBtn.href = ""; - downloadBtn.style.display = "none"; - transformBtn("none", translations[lang].translateVideo); - if (volumeOnStart) { - video.volume = volumeOnStart; - } - } - - function syncVideoVolumeSlider() { - // Sync volume slider with original video (youtube only) - const newSlidersVolume = document - .querySelector(".ytp-volume-panel") - .getAttribute("aria-valuenow"); - - const videoSlider = document.querySelector("#VOTVideoSlider"); - - if (!videoSlider) { - return; - } - videoSlider.value = newSlidersVolume; - - const videoVolumeLabel = document.querySelector("#VOTVideoVolume"); - - if (videoVolumeLabel) { - videoVolumeLabel.innerText = `${newSlidersVolume}%`; - } - - if (dbSyncVolume === 1) { - tempOriginalVolume = Number(newSlidersVolume); - } - } - - async function getVideoData() { - const videoData = {}; - - videoData.duration = video?.duration || 0; - - videoData.videoId = getVideoId(siteHostname); - - videoData.detectedLanguage = translateFromLang; - - videoData.responseLanguage = translateToLang; - - if (window.location.hostname.includes("youtube.com")) { - ytData = await getYTVideoData(); - ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); - videoData.detectedLanguage = ytData.detectedLanguage; - videoData.responseLanguage = ytData.responseLanguage; - } else if ( - window.location.hostname.includes("rutube") || - window.location.hostname.includes("my.mail.ru") - ) { - videoData.detectedLanguage = "ru"; - videoData.responseLanguage = "en"; - } else if (window.location.hostname.includes("bilibili.com")) { - videoData.detectedLanguage = "zh"; - } - - return videoData; - } - - const lipSync = (mode = false) => { - utils_debug.log("lipsync video", video); - if (!video) { - return; - } - audio.currentTime = video.currentTime; - audio.playbackRate = video.playbackRate; - - if (!mode) { - utils_debug.log("lipsync mode is not set"); - return; - } - - if (mode === "play") { - utils_debug.log("lipsync mode is play"); - const audioPromise = audio.play(); - if (audioPromise !== undefined) { - audioPromise.catch((e) => { - console.error(e); - if (e.name === "NotAllowedError") { - const errorMessage = translations[lang].grantPermissionToAutoPlay; - transformBtn("error", errorMessage); - throw `VOT: ${errorMessage}`; - } else if (e.name === "NotSupportedError") { - const errorMessage = sitesChromiumBlocked.includes( - window.location.hostname - ) - ? translations[lang].neededAdditionalExtension - : translations[lang].audioFormatNotSupported; - transformBtn("error", errorMessage); - throw `VOT: ${errorMessage}`; - } - }); - } - return; - } - if (mode === "pause" || "stop" || 0 || 0) { - utils_debug.log(`lipsync mode is ${mode}`); - audio.pause(); - } - if (mode === "playing") { - utils_debug.log("lipsync mode is playing"); - audio.play(); - } - }; - - function addVideoSlider() { - if ( - dbShowVideoSlider !== 1 || - document.querySelector("#VOTVideoSlider") || - document.querySelector(".translationBtn").dataset.state !== "success" - ) { - return; - } - - const newVolume = - window.location.hostname.includes("youtube.com") && - !dbAutoSetVolumeYandexStyle - ? document - .querySelector(".ytp-volume-panel") - ?.getAttribute("aria-valuenow") - : Math.round(video.volume * 100); - tempOriginalVolume = newVolume; - - const slider = createMenuSlider( - "VOTVideoSlider", - newVolume, - `${translations[lang].VOTVolume}: ${newVolume}%` - ); - - slider.querySelector("#VOTVideoSlider").oninput = (event) => { - const { value } = event.target; - video.volume = value / 100; - slider.querySelector("#VOTOriginalVolume").innerText = `${value}%`; - - if (dbSyncVolume !== 1) { - return; - } - - // Sync translation volume slider with video volume slider - const translateVolumeSlider = document.querySelector( - "#VOTTranslationSlider" - ); - - if (!translateVolumeSlider) { - return; - } - const translateVolume = Number(translateVolumeSlider.value); - const finalValue = syncVolume( - audio, - value, - translateVolume, - tempOriginalVolume - ); - - translateVolumeSlider.value = finalValue; - - const translateVolumeLabel = document.querySelector( - "#VOTTranslationVolume" - ); - - if (translateVolumeLabel) { - translateVolumeLabel.innerText = `${finalValue}%`; - } - - tempVolume = finalValue; - tempOriginalVolume = value; - }; - - const menuOptions = document.querySelector(".translationMenuOptions"); - menuOptions.appendChild(slider); - } - - function addTranslationSlider() { - // Return early if slider already exists or translation is not successful - if ( - document.querySelector("#VOTTranslationSlider") || - document.querySelector(".translationBtn").dataset.state !== "success" - ) { - return; - } - - // Use dbDefaultVolume or 100 as the default translation volume - const defaultTranslateVolume = - typeof dbDefaultVolume === "number" ? dbDefaultVolume : 100; - tempOriginalVolume = defaultTranslateVolume; - - // Create a slider element with the default volume and label - const slider = createMenuSlider( - "VOTTranslationSlider", - defaultTranslateVolume, - `${translations[lang].VOTVolumeTranslation}: ${defaultTranslateVolume}%` - ); - - // Add an input event listener to the slider - slider.querySelector("#VOTTranslationSlider").oninput = async ({ - target: { value }, - }) => { - // Set the audio volume to the slider value - audio.volume = value / 100; - - // Update the volume label - document.querySelector("#VOTTranslationVolume").innerText = `${value}%`; - - // Update the database with the new volume value - await updateDB({ defaultVolume: Number(value) }); - dbDefaultVolume = Number(value); - - // Sync translation volume with video volume if dbSyncVolume is 1 - if (dbSyncVolume === 1) { - syncTranslationWithVideo(value); - } - }; - - // Append the slider to the menu options - const menuOptions = document.querySelector(".translationMenuOptions"); - menuOptions.appendChild(slider); - } - - // A helper function to sync translation volume with video volume - function syncTranslationWithVideo(translationValue) { - // Get the video volume slider element - const videoVolumeSlider = document.querySelector("#VOTVideoSlider"); - - if (!videoVolumeSlider) { - return; - } - // Get the video volume value - const videoVolume = Number(videoVolumeSlider.value); - - // Calculate the synced video volume based on the translation volume - const finalValue = syncVolume( - video, - translationValue, - videoVolume, - tempVolume - ); - - // Set the video volume slider value to the synced value - videoVolumeSlider.value = finalValue; - - // Update the video volume label - const videoVolumeLabel = document.querySelector("#VOTOriginalVolume"); - if (videoVolumeLabel) videoVolumeLabel.innerText = `${finalValue}%`; - - // Update the temp variables for future syncing - tempOriginalVolume = finalValue; - tempVolume = translationValue; - } - - async function videoValidator() { - if (window.location.hostname.includes("youtube.com")) { - ytData = setDetectedLangauge(ytData, ytData.detectedLanguage); - utils_debug.log("VideoValidator videoData: ", videoData); - if (dontTranslateYourLang === 1 && ytData.detectedLanguage === lang) { - firstPlay = false; - throw translations[lang].VOTDisableFromYourLang; - } - - if (ytData.isLive) { - throw translations[lang].VOTLiveNotSupported; - } - - if (ytData.isPremiere) { - throw translations[lang].VOTPremiere; - } - if (videoData.duration > 14_400) { - throw translations[lang].VOTVideoIsTooLong; - } - } - return true; - } - - const translateExecutor = async (VIDEO_ID) => { - utils_debug.log("Run videoValidator"); - await videoValidator(); - utils_debug.log("Run translateFunc"); - await translateFunc( - VIDEO_ID, - videoData.detectedLanguage, - videoData.responseLanguage - ); - }; - - // Define a function to handle common events - function handleVideoEvent(event) { - utils_debug.log(`video ${event.type}`); - lipSync(event.type); - } - - // Define a function to stop translation and clean up - function stopTranslation() { - stopTraslate(); - syncVideoVolumeSlider(); - } - - // Define a function to translate a video and handle the callback - function translateFunc(VIDEO_ID, requestLang, responseLang) { - const videoURL = `${siteTranslates[siteHostname]}${VIDEO_ID}`; - translateVideo( - videoURL, - translateFuncParam, - requestLang, - responseLang, - async (success, urlOrError) => { - utils_debug.log("[exec callback] translateVideo"); - if (getVideoId(siteHostname) !== VIDEO_ID) return; - if (!success) { - transformBtn("error", urlOrError); - // if the error line contains information that the translation is being performed, then we wait - if (urlOrError.includes(translations[lang].translationTake)) { - clearTimeout(autoRetry); - autoRetry = setTimeout( - () => translateFunc(VIDEO_ID, requestLang, responseLang), - 60_000 - ); - } - throw urlOrError; - } - - audio.src = urlOrError; - - // cf version only - if ( - false - ) {} - - volumeOnStart = video?.volume; - if (typeof dbDefaultVolume === "number") { - audio.volume = dbDefaultVolume / 100; - } - if ( - typeof dbAutoSetVolumeYandexStyle === "number" && - dbAutoSetVolumeYandexStyle - ) { - video.volume = config/* autoVolume */.IM; - } - - switch (siteHostname) { - case "twitter": - document - .querySelector('div[data-testid="app-bar-back"][role="button"]') - .addEventListener("click", stopTranslation); - break; - case "invidious": - case "piped": - break; - default: - if (siteEvent !== null) { - document.body.addEventListener(siteEvent, stopTranslation); - } - break; - } - - const siteHostnames = [ - "twitch", - "vimeo", - "facebook", - "rutube", - "twitter", - "bilibili.com", - "mail.ru", - ]; - for (let i = 0; i < siteHostnames.length; i++) { - if (siteHostname === siteHostnames[i]) { - const mutationObserver = new MutationObserver( - async (mutations) => { - mutations.forEach(async (mutation) => { - if ( - mutation.type === "attributes" && - mutation.attributeName === "src" && - mutation.target === video && - mutation.target.src !== "" - ) { - stopTranslation(); - firstPlay = true; - } - }); - } - ); - mutationObserver.observe(videoContainer, { - attributes: true, - childList: false, - subtree: true, - attributeOldValue: true, - }); - break; - } - } - - if (video && !video.paused) lipSync("play"); - const videos = document.querySelectorAll("video"); - const events = [ - "playing", - "ratechange", - "play", - "abort", - "waiting", - "pause", - ]; - videos.forEach((v) => - events.forEach((e) => v.addEventListener(e, handleVideoEvent)) - ); - transformBtn("success", translations[lang].disableTranslate); - addVideoSlider(); - addTranslationSlider(); - - const VOTVideoSlider = document.querySelector("#VOTVideoSlider"); - if (VOTVideoSlider) VOTVideoSlider.value = config/* autoVolume */.IM * 100; - - const VOTOriginalVolume = - document.querySelector("#VOTOriginalVolume"); - if (VOTOriginalVolume) { - VOTOriginalVolume.innerText = `${config/* autoVolume */.IM * 100}%`; - } - - const downloadBtn = document.querySelector(".translationDownload"); - downloadBtn.href = urlOrError; - downloadBtn.style.display = "initial"; - } - ); - } - - document.addEventListener("click", (event) => { - const block = document.querySelector(".translationBlock"); - const menuContainer = document.querySelector(".translationMenuContent"); - const isBlock = - block || event.target === block ? block.contains(event.target) : false; - const isContent = - menuContainer || event.target === menuContainer - ? menuContainer.contains(event.target) - : false; - const isVideo = - videoContainer || event.target === videoContainer - ? videoContainer.contains(event.target) - : false; - - utils_debug.log(`[document click] ${isBlock} ${isContent} ${isVideo}`); - if (!(!isBlock && !isContent)) return; - if (!isVideo) logout(0); - - menuContainer.style.display = "none"; - openedMenu = false; - }); - - const addEventListeners = (element, events, handler) => { - events.forEach((event) => element.addEventListener(event, handler)); - }; - - if (siteHostname === "pornhub") { - if (window.location.pathname.includes("view_video.php")) { - const videoElement = document.querySelector( - ".original.mainPlayerDiv > video-element > div" - ); - addEventListeners(videoElement, ["mousemove", "mouseout"], resetTimer); - } else if (window.location.pathname.includes("embed/")) { - const playerElement = document.querySelector("#player"); - addEventListeners(playerElement, ["mousemove", "mouseout"], resetTimer); - } - } else if (siteHostname === "twitter") { - const videoPlayerElement = document.querySelector( - 'div[data-testid="videoPlayer"' - ); - addEventListeners( - videoPlayerElement, - ["mousemove", "mouseout"], - resetTimer - ); - } else { - addEventListeners(videoContainer, ["mousemove", "mouseout"], resetTimer); - } - - document - .querySelector(".translationBlock") - .addEventListener("mousemove", (event) => - changeOpacityOnEvent(event, timer, opacityRatio) - ); - document - .querySelector(".translationMenuContent") - .addEventListener("mousemove", (event) => - changeOpacityOnEvent(event, timer, opacityRatio) - ); - - document.addEventListener("touchstart", (event) => - changeOpacityOnEvent(event, timer, opacityRatio) - ); - document.addEventListener("touchmove", (event) => - changeOpacityOnEvent(event, timer, opacityRatio) - ); - document.addEventListener("touchend", (event) => - changeOpacityOnEvent(event, timer, opacityRatio) - ); - - document - .querySelector(".translationBtn") - .addEventListener("click", async (event) => { - utils_debug.log("[click translationBtn] before all functions & methods"); - event.stopPropagation(); - event.stopImmediatePropagation(); - - // check if the audio source is not empty - if (audio.src) { - utils_debug.log("[click translationBtn] audio.src is not empty"); - stopTraslate(); - return; - } - - try { - utils_debug.log("[click translationBtn] trying execute translation"); - const VIDEO_ID = getVideoId(siteHostname); - - if (!VIDEO_ID) { - throw translations[lang].VOTNoVideoIDFound; - } - - await translateExecutor(VIDEO_ID); - } catch (err) { - transformBtn("error", String(err).substring(4, err.length)); - console.error(err); - } - }); - - video.addEventListener("progress", async (event) => { - event.stopPropagation(); - - if (!(firstPlay && dbAutoTranslate === 1)) { - return; - } - const VIDEO_ID = getVideoId(siteHostname); - - if (!VIDEO_ID) { - throw translations[lang].VOTNoVideoIDFound; - } - - try { - await translateExecutor(VIDEO_ID); - firstPlay = false; - } catch (err) { - transformBtn("error", String(err).substring(4, err.length)); - firstPlay = false; - } - }); - } - - async function initWebsite() { - utils_debug.log("Runned initWebsite function"); - if (config_regexes.youtubeRegex.test(window.location.hostname)) { - if (window.location.pathname.includes("embed")) { - const videoContainer = document.querySelector(".html5-video-container"); - await translateProccessor(videoContainer, "youtube", null); - return; - } - - utils_debug.log("[initWebsite] Found a match with youtube hostname"); - const ytPageEnter = () => { - const videoContainer = document.querySelector( - config_selectors.youtubeSelector - ); - if (videoContainer) { - utils_debug.log("[exec] translateProccessor youtube on page enter"); - translateProccessor(videoContainer, "youtube", "yt-translate-stop"); - } else { - if (!ytplayer || !ytplayer.config) { - utils_debug.log("[exec] ytplayer is null"); - return; - } - ytplayer.config.args.jsapicallback = () => { - utils_debug.log( - "[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)" - ); - translateProccessor(videoContainer, "youtube", "yt-translate-stop"); - }; - } - }; - - document.addEventListener("spfdone", ytPageEnter); - document.addEventListener("yt-navigate-finish", ytPageEnter); - - const ytPageLeave = () => { - document.body.dispatchEvent(new Event("yt-translate-stop")); - }; - - document.addEventListener("spfrequest", ytPageLeave); - document.addEventListener("yt-navigate-start", ytPageLeave); - - if (window.location.hostname.includes("m.youtube.com")) { - let ytmobile = await waitForElm("#player"); - if (ytmobile) { - await sleep(1000); - await translateProccessor(ytmobile, "youtube", "yt-translate-stop"); - - const mutationObserver = new MutationObserver(async (mutations) => { - for (const mutation of mutations) { - if ( - mutation.type === "attributes" && - mutation.attributeName === "src" - ) { - ytmobile = await waitForElm("#player"); - await sleep(1000); - await translateProccessor( - ytmobile, - "youtube", - "yt-translate-stop" - ); - } - } - }); - - mutationObserver.observe(ytmobile, { - attributes: true, - childList: true, - subtree: true, - attributeOldValue: true, - }); - } - const ytPageLeave = () => { - document.body.dispatchEvent(new Event("yt-translate-stop")); - }; - document.addEventListener("spfdone", ytPageLeave); - document.addEventListener("yt-navigate-finish", ytPageLeave); - document.addEventListener("spfrequest", ytPageLeave); - document.addEventListener("yt-navigate-start", ytPageLeave); - } - return; - } - if (window.location.hostname.includes("twitch.tv")) { - utils_debug.log("[initWebsite] Found a match with twitch.tv"); - if ( - window.location.hostname.includes("m.twitch.tv") && - (window.location.pathname.includes("/videos/") || - window.location.pathname.includes("/clip/")) - ) { - utils_debug.log("[initWebsite] Matched Twitch Mobile"); - const el = await waitForElm(config_selectors.twitchMobileSelector); - if (el) { - await sleep(200); - const twitchMobileSelector = document.querySelector( - config_selectors.twitchMobileSelector - ); - await translateProccessor(twitchMobileSelector, "twitch", null); - - const mutationObserver = new MutationObserver(async (mutations) => { - for (const mutation of mutations) { - if ( - mutation.type === "attributes" && - mutation.attributeName === "src" && - mutation.target === twitchMobileSelector?.querySelector("video") - ) { - await sleep(1000); - await translateProccessor(twitchMobileSelector, "twitch", null); - } - } - }); - - mutationObserver.observe(twitchMobileSelector, { - attributes: true, - childList: true, - subtree: true, - attributeOldValue: true, - }); - } - } else if ( - window.location.hostname.includes("player.twitch.tv") || - window.location.hostname.includes("clips.twitch.tv") || - window.location.pathname.includes("/videos/") || - window.location.pathname.includes("/clip/") - ) { - utils_debug.log("[initWebsite] Matched Twitch Desktop"); - const el = await waitForElm(config_selectors.twitchSelector); - if (el) { - await sleep(200); - await translateProccessor(el, "twitch", null); - } - } - utils_debug.log("[initWebsite] Exit function in the twitch section"); - return; - } - if (window.location.hostname.includes("xvideos.com")) { - utils_debug.log("[entered] xvideos"); - await sleep(1000); - await translateProccessor( - document.querySelector(".video-bg-pic"), - "xvideos", - null - ); - return; - } - if (window.location.hostname.includes("pornhub.com")) { - utils_debug.log("[entered] pornhub"); - await sleep(1000); - await translateProccessor( - document.querySelector(".mgp_videoWrapper"), - "pornhub", - null - ); - return; - } - if (sitesInvidious.includes(window.location.hostname)) { - // Need an additional extension to work in chrome-like browsers - utils_debug.log("[entered] invidious"); - await translateProccessor( - document.querySelector("#player"), - "youtube", - null - ); - } else if (sitesPiped.includes(window.location.hostname)) { - // Need an additional extension to work in chrome-like browsers - utils_debug.log("[entered] piped"); - const el = await waitForElm(config_selectors.pipedSelector); - if (el) { - let videoIDNew; - let videoID = getVideoId("youtube"); - await translateProccessor(el, "youtube", "piped"); - setInterval(async () => { - videoIDNew = getVideoId("youtube"); - if (videoID !== videoIDNew) { - if (videoIDNew) { - await translateProccessor( - document.querySelector(config_selectors.pipedSelector), - "youtube", - "piped" - ); - } - videoID = videoIDNew; - } - }, 3000); - } - } else if (/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)) { - utils_debug.log("[entered] vk.com"); - const el = await waitForElm(config_selectors.vkSelector); - if (el) { - await translateProccessor( - document.querySelector(config_selectors.vkSelector), - "vk", - null - ); - let videoIDVKNew; - let videoIDVK = getVideoId("vk"); - setInterval(async () => { - videoIDVKNew = getVideoId("vk"); - if (videoIDVK !== videoIDVKNew) { - if (videoIDVKNew) { - const el = await waitForElm(config_selectors.vkSelector); - if (el) { - await translateProccessor(el, "vk", null); - } - } - videoIDVK = videoIDVKNew; - } - }, 3000); - } - } else if (window.location.hostname.includes("vimeo.com")) { - utils_debug.log("[entered] vimeo.com"); - const el = await waitForElm(config_selectors.vimeoSelector); - if (el) { - await sleep(1000); - await translateProccessor( - document.querySelector(config_selectors.vimeoSelector), - "vimeo", - null - ); - } - } else if (window.location.hostname.includes("9gag.com")) { - await sleep(1000); - await translateProccessor( - document.querySelector(config_selectors.gagSelector), - "9gag", - null - ); - } else if (window.location.hostname.includes("coub.com")) { - await sleep(1000); - await translateProccessor( - document.querySelector(".viewer__player"), - "coub", - null - ); - } else if (window.location.hostname.includes("rutube.ru")) { - const elementSelector = window.location.pathname.includes("/play/embed") - ? "#app > div > div" - : ".video-player > div > div > div:nth-child(2)"; - - const el = await waitForElm(elementSelector); - if (el) { - await translateProccessor(el, "rutube", null); - } - } else if (window.location.hostname.includes("bilibili.com")) { - if (window.location.pathname.includes("/video/")) { - const el = await waitForElm(config_selectors.bilibilicomSelector); - if (el) { - await translateProccessor(el, "bilibili.com", null); - } - } else if ( - window.location.pathname.includes( - "/blackboard/webplayer/embed-old.html" - ) - ) { - const el = await waitForElm("video"); - if (el) { - await translateProccessor(el.parentElement, "bilibili.com", null); - } - } - } else if (window.location.hostname.includes("twitter.com")) { - const el = await waitForElm(config_selectors.twitterSelector); - if (el) { - let videoIDNew; - let videoID = getVideoId("twitter"); - await translateProccessor(el, "twitter", null); - setInterval(async () => { - videoIDNew = getVideoId("twitter"); - if (videoID !== videoIDNew) { - if (videoIDNew) { - await translateProccessor( - document.querySelector(config_selectors.twitterSelector), - "twitter", - null - ); - } - videoID = videoIDNew; - } - }, 3000); - } - } else if (window.location.hostname.includes("my.mail.ru")) { - const el = await waitForElm(config_selectors.mailSelector); - if (el) { - let videoIDNew; - let videoID = getVideoId("mail.ru"); - await translateProccessor(el, "mail.ru", null); - setInterval(async () => { - videoIDNew = getVideoId("mail.ru"); - if (videoID !== videoIDNew) { - if (videoIDNew) { - await translateProccessor( - document.querySelector(config_selectors.mailSelector), - "mail.ru", - null - ); - } - videoID = videoIDNew; - } - }, 3000); - } - } - } - - await initWebsite(); -} - -src_main().catch((e) => { - console.error(e); -}); - -})(); - -/******/ })() -; \ No newline at end of file From 8c69837c4161b4f6e17a33b984cc7d0989baef2c Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Sat, 22 Jul 2023 08:58:19 +0400 Subject: [PATCH 07/48] =?UTF-8?q?=D0=9F=D0=BE=D0=BF=D1=8B=D1=82=D0=BA?= =?UTF-8?q?=D0=B0=20=E2=84=962?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/vot-cloudflare-min.user.js | 2 +- dist/vot-cloudflare.user.js | 14 +++++++------- dist/vot-min.user.js | 2 +- dist/vot.user.js | 14 +++++++------- src/index.js | 14 +++++++------- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/dist/vot-cloudflare-min.user.js b/dist/vot-cloudflare-min.user.js index 2ee115a9..93020226 100644 --- a/dist/vot-cloudflare-min.user.js +++ b/dist/vot-cloudflare-min.user.js @@ -84,4 +84,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),b=n("./src/utils/debug.js");let f=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function y(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),y("#7A7A7D"),V(e);break;case"success":w(e),y("#A36EFF"),V(e);break;default:w("none"),y("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}f in v.Iz||(f="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[f].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[f].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[f].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[f].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[f].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[f].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const $={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},Z=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){b.Z.log("Loading extension..."),b.Z.log(`Selected menu language: ${f}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;b.Z.log("Inited requestVideoTranslation..."),b.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,y,V,w,L,F,M,z,A,q;b.Z.log("[translateProccessor] execute on element: ",n);let E,$=!0;b.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),b.Z.log("video",p);let Z=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",Z);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[f].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),b.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[f].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),b.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[f].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[f][t],value:e,selected:Z.detectedLanguage===e})))],t=[{label:v.Iz[f].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[f][t],value:e,selected:Z.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(e=>{b.Z.log("[onchange] select from language",e.target.value),Z=Y(Z,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(e=>{b.Z.log("[onchange] select to language",e.target.value),Z=W(Z,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[f].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[f].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[f].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[f].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,b.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[f].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[f].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,b.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[f].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,b.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[f].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,b.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[f].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,b.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[f].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,b.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[f].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,b.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}function U(e,t=f){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t)}function Y(e,t){switch(t){case"en":e.detectedLanguage=t,e.responseLanguage=f;break;case"ru":e.detectedLanguage=t,e.responseLanguage=f,"ru"==f&&(e.responseLanguage="en");break;default:if(!Object.keys(v.tW).includes(t))return Y(e,"en");e.detectedLanguage=t}return U(e.detectedLanguage,e.responseLanguage),e}function W(e,t){if("en"===t)e.responseLanguage=t,e.detectedLanguage="ru";else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===f&&(e.detectedLanguage="en"),e.responseLanguage=t}return U(e.detectedLanguage,e.responseLanguage),e}function G(){o.pause(),p.removeEventListener(".translate",G,!1),o.src="",o.removeAttribute("src"),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[f].translateVideo),g&&(p.volume=g)}function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(y=Number(e))}O("none",v.Iz[f].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=(e=!1)=>{if(b.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)b.Z.log(`lipsync mode is ${e}`),o.pause(),"playing"===e&&(b.Z.log("lipsync mode is playing"),o.play());else{b.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[f].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[f].neededAdditionalExtension:v.Iz[f].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else b.Z.log("lipsync mode is not set")};function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);y=e;const t=x("VOTVideoSlider",e,`${v.Iz[f].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,y);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,y=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{b.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(ee=Y(ee,ee.detectedLanguage),b.Z.log("VideoValidator videoData: ",Z),1===z&&ee.detectedLanguage===f)throw $=!1,v.Iz[f].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[f].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[f].VOTPremiere;if(Z.duration>14400)throw v.Iz[f].VOTVideoIsTooLong}return!0}(),b.Z.log("Run translateFunc"),await ae(e,Z.detectedLanguage,Z.responseLanguage)};function ne(e){b.Z.log(`video ${e.type}`),J(e.type)}function oe(){G(),K()}function ae(t,a,i){!function(t,n,o,a,i){b.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?b.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,b.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[f].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[f].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[f].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[f].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[f].translationTakeAboutMinute:v.Iz[f].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[f].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[f].videoBeingTranslated)}})))}(`${v.g$[u]}${t}`,v.ey,a,i,(async(e,r)=>{if(b.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[f].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),$=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[f].disableTranslate),X(),function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;y=e;const t=x("VOTTranslationSlider",e,`${v.Iz[f].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),y=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);b.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,n)))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(b.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return b.Z.log("[click translationBtn] audio.src is not empty"),void G();try{b.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[f].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!$||1!==w)return;const t=I(u);if(!t)throw v.Iz[f].VOTNoVideoIDFound;try{await te(t),$=!1}catch(e){O("error",String(e).substring(4,e.length)),$=!1}}))}await async function(){if(b.Z.log("Runned initWebsite function"),$.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}b.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(Z);if(e)b.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void b.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{b.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(b.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(b.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){b.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}b.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return b.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return b.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))b.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){b.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(b.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))b.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const $={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},Z=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,$=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let Z=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",Z);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:Z.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:Z.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),Z=await Y(Z,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),Z=await W(Z,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}function U(e,t=b){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t)}async function Y(e,t){switch(t){case"en":e.detectedLanguage=t,e.responseLanguage=b;break;case"ru":e.detectedLanguage=t,e.responseLanguage=b,"ru"==b&&(e.responseLanguage="en");break;default:if(!Object.keys(v.tW).includes(t))return Y(e,"en");e.detectedLanguage=t}return U(e.detectedLanguage,e.responseLanguage),e}async function W(e,t){if("en"===t)e.responseLanguage=t,e.detectedLanguage="ru";else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return U(e.detectedLanguage,e.responseLanguage),e}function G(){o.pause(),p.removeEventListener(".translate",G,!1),o.src="",o.removeAttribute("src"),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)y.Z.log(`lipsync mode is ${e}`),o.pause(),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(ee=Y(ee,ee.detectedLanguage),y.Z.log("VideoValidator videoData: ",Z),1===z&&ee.detectedLanguage===b)throw $=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if(Z.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,Z.detectedLanguage,Z.responseLanguage)};function ne(e){y.Z.log(`video ${e.type}`),J(e.type)}function oe(){G(),K()}function ae(t,a,i){!function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(`${v.g$[u]}${t}`,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),$=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),X(),function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,n)))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!$||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),$=!1}catch(e){O("error",String(e).substring(4,e.length)),$=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),$.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(Z);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot-cloudflare.user.js b/dist/vot-cloudflare.user.js index bdd0e30f..8318a36d 100644 --- a/dist/vot-cloudflare.user.js +++ b/dist/vot-cloudflare.user.js @@ -2736,16 +2736,16 @@ async function src_main() { menuOptions .querySelector("#VOTTranslateFromLang") - .addEventListener("change", (event) => { + .addEventListener("change", async (event) => { debug/* default */.Z.log("[onchange] select from language", event.target.value); - videoData = setDetectedLangauge(videoData, event.target.value); + videoData = await setDetectedLangauge(videoData, event.target.value); }); menuOptions .querySelector("#VOTTranslateToLang") - .addEventListener("change", (event) => { + .addEventListener("change", async (event) => { debug/* default */.Z.log("[onchange] select to language", event.target.value); - videoData = setResponseLangauge(videoData, event.target.value); + videoData = await setResponseLangauge(videoData, event.target.value); }); } @@ -2972,7 +2972,7 @@ async function src_main() { } // data - ytData or VideoData - function setDetectedLangauge(data, videolang) { + async function setDetectedLangauge(data, videolang) { switch (videolang) { case "en": data.detectedLanguage = videolang; @@ -2997,7 +2997,7 @@ async function src_main() { } // data - ytData or VideoData - function setResponseLangauge(data, videolang) { + async function setResponseLangauge(data, videolang) { switch (videolang) { case "en": data.responseLanguage = videolang; @@ -3073,7 +3073,7 @@ async function src_main() { if (window.location.hostname.includes("youtube.com")) { ytData = await getYTVideoData(); - ytData = setDetectedLangauge(ytData, ytData.detectedLanguage); + ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); videoData.detectedLanguage = ytData.detectedLanguage; videoData.responseLanguage = ytData.responseLanguage; } else if ( diff --git a/dist/vot-min.user.js b/dist/vot-min.user.js index efeecc3f..c7371043 100644 --- a/dist/vot-min.user.js +++ b/dist/vot-min.user.js @@ -83,4 +83,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>a,IM:()=>r,Rr:()=>i,iF:()=>o});const o="api.browser.yandex.ru",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var a=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=o(!0),d=a.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},b={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},y={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function k(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function L(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function F(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in y||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${y[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=y[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(B);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,z)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=y[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=y[V].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=y[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=y[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=y[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${y[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${y[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:y[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:y[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:y[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:y[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),o=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(e=>{f.log("[onchange] select from language",e.target.value),_=G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(e=>{f.log("[onchange] select to language",e.target.value),_=W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=y[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=y[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(y[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),j(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=y[V].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=x("VOTAutoTranslate",O,y[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${y[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=x("VOTDontTranslateYourLang",E,y[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=x("VOTAutoSetVolume",M,y[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=x("VOTShowVideoSlider",D,y[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=x("VOTSyncVolume",I,y[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}function Y(e,t=V){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t)}function G(e,t){switch(t){case"en":e.detectedLanguage=t,e.responseLanguage=V;break;case"ru":e.detectedLanguage=t,e.responseLanguage=V,"ru"==V&&(e.responseLanguage="en");break;default:if(!Object.keys(v).includes(t))return G(e,"en");e.detectedLanguage=t}return Y(e.detectedLanguage,e.responseLanguage),e}function W(e,t){if("en"===t)e.responseLanguage=t,e.detectedLanguage="ru";else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return Y(e.detectedLanguage,e.responseLanguage),e}function Z(){o.pause(),c.removeEventListener(".translate",Z,!1),o.src="",o.removeAttribute("src"),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",k("none",y[V].translateVideo),m&&(c.volume=m)}function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}k("none",y[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=(e=!1)=>{if(f.log("lipsync video",c),c)if(o.currentTime=c.currentTime,o.playbackRate=c.playbackRate,e)if("play"!==e)f.log(`lipsync mode is ${e}`),o.pause(),"playing"===e&&(f.log("lipsync mode is playing"),o.play());else{f.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=y[V].grantPermissionToAutoPlay;throw k("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?y[V].neededAdditionalExtension:y[V].audioFormatNotSupported;throw k("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${y[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=$(o,n,i,g);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(te=G(te,te.detectedLanguage),f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V)throw z=!1,y[V].VOTDisableFromYourLang;if(te.isLive)throw y[V].VOTLiveNotSupported;if(te.isPremiere)throw y[V].VOTPremiere;if(_.duration>14400)throw y[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await ae(e,_.detectedLanguage,_.responseLanguage)};function ne(e){f.log(`video ${e.type}`),J(e.type)}function oe(){Z(),K()}function ae(t,a,i){!function(t,n,o,a,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),e(t,n,o,a,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,y[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||y[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?y[V].translationTakeMoreThanHour:t>=10&&t%10?y[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?y[V].translationTakeAboutMinute:y[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):y[V].translationTakeFewMinutes);break;case 3:i(!1,y[V].videoBeingTranslated)}}))}(`${b[d]}${t}`,0x4075500000000000,a,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw k("error",r),r.includes(y[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>ae(t,a,i)),6e4)),r;switch(o.src=r,m=c?.volume,"number"==typeof S&&(o.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(oe(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),k("success",y[V].disableTranslate),X(),function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${y[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=$(c,e,n,w);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),g=o,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const b=document.querySelector(".translationDownload");b.href=r,b.style.display="initial"}))}document.addEventListener("click",(e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${a} ${s} ${l}`),a||s||(l||r(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,n)))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,a))),document.addEventListener("touchstart",(e=>l(e,t,a))),document.addEventListener("touchmove",(e=>l(e,t,a))),document.addEventListener("touchend",(e=>l(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return f.log("[click translationBtn] audio.src is not empty"),void Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw y[V].VOTNoVideoIDFound;await Q(e)}catch(e){k("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw y[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){k("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>a,IM:()=>r,Rr:()=>i,iF:()=>o});const o="api.browser.yandex.ru",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var a=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=o(!0),d=a.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},b={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},y={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function k(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function L(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function F(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in y||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${y[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=y[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(B);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,z)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=y[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=y[V].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=y[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=y[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=y[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${y[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${y[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:y[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:y[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:y[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:y[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),o=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),_=await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=y[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=y[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(y[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),j(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=y[V].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=x("VOTAutoTranslate",O,y[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${y[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=x("VOTDontTranslateYourLang",E,y[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=x("VOTAutoSetVolume",M,y[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=x("VOTShowVideoSlider",D,y[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=x("VOTSyncVolume",I,y[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}function Y(e,t=V){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t)}async function G(e,t){switch(t){case"en":e.detectedLanguage=t,e.responseLanguage=V;break;case"ru":e.detectedLanguage=t,e.responseLanguage=V,"ru"==V&&(e.responseLanguage="en");break;default:if(!Object.keys(v).includes(t))return G(e,"en");e.detectedLanguage=t}return Y(e.detectedLanguage,e.responseLanguage),e}async function W(e,t){if("en"===t)e.responseLanguage=t,e.detectedLanguage="ru";else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return Y(e.detectedLanguage,e.responseLanguage),e}function Z(){o.pause(),c.removeEventListener(".translate",Z,!1),o.src="",o.removeAttribute("src"),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",k("none",y[V].translateVideo),m&&(c.volume=m)}function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}k("none",y[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=(e=!1)=>{if(f.log("lipsync video",c),c)if(o.currentTime=c.currentTime,o.playbackRate=c.playbackRate,e)if("play"!==e)f.log(`lipsync mode is ${e}`),o.pause(),"playing"===e&&(f.log("lipsync mode is playing"),o.play());else{f.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=y[V].grantPermissionToAutoPlay;throw k("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?y[V].neededAdditionalExtension:y[V].audioFormatNotSupported;throw k("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${y[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=$(o,n,i,g);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(te=G(te,te.detectedLanguage),f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V)throw z=!1,y[V].VOTDisableFromYourLang;if(te.isLive)throw y[V].VOTLiveNotSupported;if(te.isPremiere)throw y[V].VOTPremiere;if(_.duration>14400)throw y[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await ae(e,_.detectedLanguage,_.responseLanguage)};function ne(e){f.log(`video ${e.type}`),J(e.type)}function oe(){Z(),K()}function ae(t,a,i){!function(t,n,o,a,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),e(t,n,o,a,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,y[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||y[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?y[V].translationTakeMoreThanHour:t>=10&&t%10?y[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?y[V].translationTakeAboutMinute:y[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):y[V].translationTakeFewMinutes);break;case 3:i(!1,y[V].videoBeingTranslated)}}))}(`${b[d]}${t}`,0x4075500000000000,a,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw k("error",r),r.includes(y[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>ae(t,a,i)),6e4)),r;switch(o.src=r,m=c?.volume,"number"==typeof S&&(o.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(oe(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),k("success",y[V].disableTranslate),X(),function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${y[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=$(c,e,n,w);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),g=o,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const b=document.querySelector(".translationDownload");b.href=r,b.style.display="initial"}))}document.addEventListener("click",(e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${a} ${s} ${l}`),a||s||(l||r(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,n)))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,a))),document.addEventListener("touchstart",(e=>l(e,t,a))),document.addEventListener("touchmove",(e=>l(e,t,a))),document.addEventListener("touchend",(e=>l(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return f.log("[click translationBtn] audio.src is not empty"),void Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw y[V].VOTNoVideoIDFound;await Q(e)}catch(e){k("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw y[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){k("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot.user.js b/dist/vot.user.js index dd7ecb3f..3f174b9b 100644 --- a/dist/vot.user.js +++ b/dist/vot.user.js @@ -2684,16 +2684,16 @@ async function src_main() { menuOptions .querySelector("#VOTTranslateFromLang") - .addEventListener("change", (event) => { + .addEventListener("change", async (event) => { utils_debug.log("[onchange] select from language", event.target.value); - videoData = setDetectedLangauge(videoData, event.target.value); + videoData = await setDetectedLangauge(videoData, event.target.value); }); menuOptions .querySelector("#VOTTranslateToLang") - .addEventListener("change", (event) => { + .addEventListener("change", async (event) => { utils_debug.log("[onchange] select to language", event.target.value); - videoData = setResponseLangauge(videoData, event.target.value); + videoData = await setResponseLangauge(videoData, event.target.value); }); } @@ -2901,7 +2901,7 @@ async function src_main() { } // data - ytData or VideoData - function setDetectedLangauge(data, videolang) { + async function setDetectedLangauge(data, videolang) { switch (videolang) { case "en": data.detectedLanguage = videolang; @@ -2926,7 +2926,7 @@ async function src_main() { } // data - ytData or VideoData - function setResponseLangauge(data, videolang) { + async function setResponseLangauge(data, videolang) { switch (videolang) { case "en": data.responseLanguage = videolang; @@ -3002,7 +3002,7 @@ async function src_main() { if (window.location.hostname.includes("youtube.com")) { ytData = await getYTVideoData(); - ytData = setDetectedLangauge(ytData, ytData.detectedLanguage); + ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); videoData.detectedLanguage = ytData.detectedLanguage; videoData.responseLanguage = ytData.responseLanguage; } else if ( diff --git a/src/index.js b/src/index.js index d8eb26fd..05c7ba90 100644 --- a/src/index.js +++ b/src/index.js @@ -296,16 +296,16 @@ async function main() { menuOptions .querySelector("#VOTTranslateFromLang") - .addEventListener("change", (event) => { + .addEventListener("change", async (event) => { debug.log("[onchange] select from language", event.target.value); - videoData = setDetectedLangauge(videoData, event.target.value); + videoData = await setDetectedLangauge(videoData, event.target.value); }); menuOptions .querySelector("#VOTTranslateToLang") - .addEventListener("change", (event) => { + .addEventListener("change", async (event) => { debug.log("[onchange] select to language", event.target.value); - videoData = setResponseLangauge(videoData, event.target.value); + videoData = await setResponseLangauge(videoData, event.target.value); }); } @@ -532,7 +532,7 @@ async function main() { } // data - ytData or VideoData - function setDetectedLangauge(data, videolang) { + async function setDetectedLangauge(data, videolang) { switch (videolang) { case "en": data.detectedLanguage = videolang; @@ -557,7 +557,7 @@ async function main() { } // data - ytData or VideoData - function setResponseLangauge(data, videolang) { + async function setResponseLangauge(data, videolang) { switch (videolang) { case "en": data.responseLanguage = videolang; @@ -633,7 +633,7 @@ async function main() { if (window.location.hostname.includes("youtube.com")) { ytData = await getYTVideoData(); - ytData = setDetectedLangauge(ytData, ytData.detectedLanguage); + ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); videoData.detectedLanguage = ytData.detectedLanguage; videoData.responseLanguage = ytData.responseLanguage; } else if ( From 1d8ccf01cace3b4e3a3d3668200d0731ca5592d4 Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Sat, 22 Jul 2023 09:08:08 +0400 Subject: [PATCH 08/48] =?UTF-8?q?=D0=9F=D0=BE=D0=BF=D1=8B=D1=82=D0=BA?= =?UTF-8?q?=D0=B0=20=E2=84=963?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/vot-cloudflare-min.user.js | 2 +- dist/vot-cloudflare.user.js | 2 +- dist/vot-min.user.js | 2 +- dist/vot.user.js | 2 +- src/index.js | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dist/vot-cloudflare-min.user.js b/dist/vot-cloudflare-min.user.js index 93020226..dc9e4bd0 100644 --- a/dist/vot-cloudflare-min.user.js +++ b/dist/vot-cloudflare-min.user.js @@ -84,4 +84,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const $={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},Z=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,$=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let Z=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",Z);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:Z.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:Z.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),Z=await Y(Z,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),Z=await W(Z,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}function U(e,t=b){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t)}async function Y(e,t){switch(t){case"en":e.detectedLanguage=t,e.responseLanguage=b;break;case"ru":e.detectedLanguage=t,e.responseLanguage=b,"ru"==b&&(e.responseLanguage="en");break;default:if(!Object.keys(v.tW).includes(t))return Y(e,"en");e.detectedLanguage=t}return U(e.detectedLanguage,e.responseLanguage),e}async function W(e,t){if("en"===t)e.responseLanguage=t,e.detectedLanguage="ru";else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return U(e.detectedLanguage,e.responseLanguage),e}function G(){o.pause(),p.removeEventListener(".translate",G,!1),o.src="",o.removeAttribute("src"),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)y.Z.log(`lipsync mode is ${e}`),o.pause(),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(ee=Y(ee,ee.detectedLanguage),y.Z.log("VideoValidator videoData: ",Z),1===z&&ee.detectedLanguage===b)throw $=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if(Z.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,Z.detectedLanguage,Z.responseLanguage)};function ne(e){y.Z.log(`video ${e.type}`),J(e.type)}function oe(){G(),K()}function ae(t,a,i){!function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(`${v.g$[u]}${t}`,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),$=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),X(),function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,n)))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!$||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),$=!1}catch(e){O("error",String(e).substring(4,e.length)),$=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),$.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(Z);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const $={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},Z=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,$=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let Z=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",Z);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:Z.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:Z.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),Z=await Y(Z,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),Z=await W(Z,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}function U(e,t=b){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t)}async function Y(e,t){switch(t){case"en":e.detectedLanguage=t,e.responseLanguage=b;break;case"ru":e.detectedLanguage=t,e.responseLanguage=b,"ru"==b&&(e.responseLanguage="en");break;default:if(!Object.keys(v.tW).includes(t))return Y(e,"en");e.detectedLanguage=t}return U(e.detectedLanguage,e.responseLanguage),e}async function W(e,t){if("en"===t)e.responseLanguage=t,e.detectedLanguage="ru";else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return U(e.detectedLanguage,e.responseLanguage),e}function G(){o.pause(),p.removeEventListener(".translate",G,!1),o.src="",o.removeAttribute("src"),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)y.Z.log(`lipsync mode is ${e}`),o.pause(),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(ee=await Y(ee,ee.detectedLanguage),y.Z.log("VideoValidator videoData: ",Z),1===z&&ee.detectedLanguage===b)throw $=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if(Z.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,Z.detectedLanguage,Z.responseLanguage)};function ne(e){y.Z.log(`video ${e.type}`),J(e.type)}function oe(){G(),K()}function ae(t,a,i){!function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(`${v.g$[u]}${t}`,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),$=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),X(),function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,n)))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!$||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),$=!1}catch(e){O("error",String(e).substring(4,e.length)),$=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),$.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(Z);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot-cloudflare.user.js b/dist/vot-cloudflare.user.js index 8318a36d..cc032ee9 100644 --- a/dist/vot-cloudflare.user.js +++ b/dist/vot-cloudflare.user.js @@ -3281,7 +3281,7 @@ async function src_main() { async function videoValidator() { if (window.location.hostname.includes("youtube.com")) { - ytData = setDetectedLangauge(ytData, ytData.detectedLanguage); + ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); debug/* default */.Z.log("VideoValidator videoData: ", videoData); if (dontTranslateYourLang === 1 && ytData.detectedLanguage === lang) { firstPlay = false; diff --git a/dist/vot-min.user.js b/dist/vot-min.user.js index c7371043..87ab71a7 100644 --- a/dist/vot-min.user.js +++ b/dist/vot-min.user.js @@ -83,4 +83,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>a,IM:()=>r,Rr:()=>i,iF:()=>o});const o="api.browser.yandex.ru",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var a=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=o(!0),d=a.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},b={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},y={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function k(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function L(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function F(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in y||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${y[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=y[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(B);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,z)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=y[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=y[V].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=y[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=y[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=y[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${y[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${y[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:y[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:y[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:y[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:y[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),o=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),_=await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=y[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=y[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(y[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),j(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=y[V].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=x("VOTAutoTranslate",O,y[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${y[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=x("VOTDontTranslateYourLang",E,y[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=x("VOTAutoSetVolume",M,y[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=x("VOTShowVideoSlider",D,y[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=x("VOTSyncVolume",I,y[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}function Y(e,t=V){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t)}async function G(e,t){switch(t){case"en":e.detectedLanguage=t,e.responseLanguage=V;break;case"ru":e.detectedLanguage=t,e.responseLanguage=V,"ru"==V&&(e.responseLanguage="en");break;default:if(!Object.keys(v).includes(t))return G(e,"en");e.detectedLanguage=t}return Y(e.detectedLanguage,e.responseLanguage),e}async function W(e,t){if("en"===t)e.responseLanguage=t,e.detectedLanguage="ru";else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return Y(e.detectedLanguage,e.responseLanguage),e}function Z(){o.pause(),c.removeEventListener(".translate",Z,!1),o.src="",o.removeAttribute("src"),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",k("none",y[V].translateVideo),m&&(c.volume=m)}function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}k("none",y[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=(e=!1)=>{if(f.log("lipsync video",c),c)if(o.currentTime=c.currentTime,o.playbackRate=c.playbackRate,e)if("play"!==e)f.log(`lipsync mode is ${e}`),o.pause(),"playing"===e&&(f.log("lipsync mode is playing"),o.play());else{f.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=y[V].grantPermissionToAutoPlay;throw k("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?y[V].neededAdditionalExtension:y[V].audioFormatNotSupported;throw k("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${y[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=$(o,n,i,g);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(te=G(te,te.detectedLanguage),f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V)throw z=!1,y[V].VOTDisableFromYourLang;if(te.isLive)throw y[V].VOTLiveNotSupported;if(te.isPremiere)throw y[V].VOTPremiere;if(_.duration>14400)throw y[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await ae(e,_.detectedLanguage,_.responseLanguage)};function ne(e){f.log(`video ${e.type}`),J(e.type)}function oe(){Z(),K()}function ae(t,a,i){!function(t,n,o,a,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),e(t,n,o,a,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,y[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||y[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?y[V].translationTakeMoreThanHour:t>=10&&t%10?y[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?y[V].translationTakeAboutMinute:y[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):y[V].translationTakeFewMinutes);break;case 3:i(!1,y[V].videoBeingTranslated)}}))}(`${b[d]}${t}`,0x4075500000000000,a,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw k("error",r),r.includes(y[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>ae(t,a,i)),6e4)),r;switch(o.src=r,m=c?.volume,"number"==typeof S&&(o.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(oe(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),k("success",y[V].disableTranslate),X(),function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${y[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=$(c,e,n,w);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),g=o,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const b=document.querySelector(".translationDownload");b.href=r,b.style.display="initial"}))}document.addEventListener("click",(e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${a} ${s} ${l}`),a||s||(l||r(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,n)))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,a))),document.addEventListener("touchstart",(e=>l(e,t,a))),document.addEventListener("touchmove",(e=>l(e,t,a))),document.addEventListener("touchend",(e=>l(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return f.log("[click translationBtn] audio.src is not empty"),void Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw y[V].VOTNoVideoIDFound;await Q(e)}catch(e){k("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw y[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){k("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>a,IM:()=>r,Rr:()=>i,iF:()=>o});const o="api.browser.yandex.ru",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var a=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=o(!0),d=a.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},b={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},y={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function k(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function L(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function F(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in y||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${y[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=y[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(B);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,z)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=y[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=y[V].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=y[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=y[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=y[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${y[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${y[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:y[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:y[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:y[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:y[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),o=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),_=await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=y[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=y[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(y[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),j(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=y[V].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=x("VOTAutoTranslate",O,y[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${y[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=x("VOTDontTranslateYourLang",E,y[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=x("VOTAutoSetVolume",M,y[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=x("VOTShowVideoSlider",D,y[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=x("VOTSyncVolume",I,y[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}function Y(e,t=V){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t)}async function G(e,t){switch(t){case"en":e.detectedLanguage=t,e.responseLanguage=V;break;case"ru":e.detectedLanguage=t,e.responseLanguage=V,"ru"==V&&(e.responseLanguage="en");break;default:if(!Object.keys(v).includes(t))return G(e,"en");e.detectedLanguage=t}return Y(e.detectedLanguage,e.responseLanguage),e}async function W(e,t){if("en"===t)e.responseLanguage=t,e.detectedLanguage="ru";else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return Y(e.detectedLanguage,e.responseLanguage),e}function Z(){o.pause(),c.removeEventListener(".translate",Z,!1),o.src="",o.removeAttribute("src"),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",k("none",y[V].translateVideo),m&&(c.volume=m)}function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}k("none",y[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=(e=!1)=>{if(f.log("lipsync video",c),c)if(o.currentTime=c.currentTime,o.playbackRate=c.playbackRate,e)if("play"!==e)f.log(`lipsync mode is ${e}`),o.pause(),"playing"===e&&(f.log("lipsync mode is playing"),o.play());else{f.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=y[V].grantPermissionToAutoPlay;throw k("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?y[V].neededAdditionalExtension:y[V].audioFormatNotSupported;throw k("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${y[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=$(o,n,i,g);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(te=await G(te,te.detectedLanguage),f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V)throw z=!1,y[V].VOTDisableFromYourLang;if(te.isLive)throw y[V].VOTLiveNotSupported;if(te.isPremiere)throw y[V].VOTPremiere;if(_.duration>14400)throw y[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await ae(e,_.detectedLanguage,_.responseLanguage)};function ne(e){f.log(`video ${e.type}`),J(e.type)}function oe(){Z(),K()}function ae(t,a,i){!function(t,n,o,a,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),e(t,n,o,a,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,y[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||y[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?y[V].translationTakeMoreThanHour:t>=10&&t%10?y[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?y[V].translationTakeAboutMinute:y[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):y[V].translationTakeFewMinutes);break;case 3:i(!1,y[V].videoBeingTranslated)}}))}(`${b[d]}${t}`,0x4075500000000000,a,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw k("error",r),r.includes(y[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>ae(t,a,i)),6e4)),r;switch(o.src=r,m=c?.volume,"number"==typeof S&&(o.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(oe(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),k("success",y[V].disableTranslate),X(),function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${y[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=$(c,e,n,w);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),g=o,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const b=document.querySelector(".translationDownload");b.href=r,b.style.display="initial"}))}document.addEventListener("click",(e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${a} ${s} ${l}`),a||s||(l||r(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,n)))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,a))),document.addEventListener("touchstart",(e=>l(e,t,a))),document.addEventListener("touchmove",(e=>l(e,t,a))),document.addEventListener("touchend",(e=>l(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return f.log("[click translationBtn] audio.src is not empty"),void Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw y[V].VOTNoVideoIDFound;await Q(e)}catch(e){k("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw y[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){k("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot.user.js b/dist/vot.user.js index 3f174b9b..29f16920 100644 --- a/dist/vot.user.js +++ b/dist/vot.user.js @@ -3210,7 +3210,7 @@ async function src_main() { async function videoValidator() { if (window.location.hostname.includes("youtube.com")) { - ytData = setDetectedLangauge(ytData, ytData.detectedLanguage); + ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); utils_debug.log("VideoValidator videoData: ", videoData); if (dontTranslateYourLang === 1 && ytData.detectedLanguage === lang) { firstPlay = false; diff --git a/src/index.js b/src/index.js index 05c7ba90..57e9b1dc 100644 --- a/src/index.js +++ b/src/index.js @@ -841,7 +841,7 @@ async function main() { async function videoValidator() { if (window.location.hostname.includes("youtube.com")) { - ytData = setDetectedLangauge(ytData, ytData.detectedLanguage); + ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); debug.log("VideoValidator videoData: ", videoData); if (dontTranslateYourLang === 1 && ytData.detectedLanguage === lang) { firstPlay = false; From 515843c9cdc8784d16288a2d733d699b9ecac3a6 Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Sun, 23 Jul 2023 09:52:20 +0400 Subject: [PATCH 09/48] Add files via upload --- package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index 68d16f73..92236f0e 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,6 @@ "css-loader": "^6.8.1", "style-loader": "^3.3.3", "tslib": "^2.5.3", - "tinyld": "^1.3.4", "webpack": "^5.81.0", "webpack-cli": "^5.1.4", "prettier": "^2.8.2", @@ -37,4 +36,4 @@ "format": "prettier --write --ignore-unknown \"{web-server,src}/**/*.{html,css,js,ts,json}\"", "dev": "webpack serve --node-env development" } -} +} \ No newline at end of file From f0b97c39e170f23f1c6fe22a838cad285488cc6c Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Mon, 24 Jul 2023 22:09:05 +0400 Subject: [PATCH 10/48] More async code --- dist/vot-cloudflare-min.user.js | 4 +-- dist/vot-cloudflare.user.js | 44 ++++++++++++++++++--------------- dist/vot-min.user.js | 4 +-- dist/vot.user.js | 44 ++++++++++++++++++--------------- src/headers.json | 2 +- src/index.js | 42 +++++++++++++++++-------------- 6 files changed, 76 insertions(+), 64 deletions(-) diff --git a/dist/vot-cloudflare-min.user.js b/dist/vot-cloudflare-min.user.js index dc9e4bd0..e18c40c6 100644 --- a/dist/vot-cloudflare-min.user.js +++ b/dist/vot-cloudflare-min.user.js @@ -80,8 +80,8 @@ // @icon https://translate.yandex.ru/icons/favicon.ico // @inject-into page // @namespace vot-cloudflare -// @require https://cdnjs.cloudflare.com/ajax/libs/protobufjs/7.2.3/protobuf.min.js +// @require https://cdnjs.cloudflare.com/ajax/libs/protobufjs/7.2.3/light/protobuf.min.js // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const $={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},Z=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,$=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let Z=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",Z);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:Z.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:Z.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),Z=await Y(Z,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),Z=await W(Z,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}function U(e,t=b){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t)}async function Y(e,t){switch(t){case"en":e.detectedLanguage=t,e.responseLanguage=b;break;case"ru":e.detectedLanguage=t,e.responseLanguage=b,"ru"==b&&(e.responseLanguage="en");break;default:if(!Object.keys(v.tW).includes(t))return Y(e,"en");e.detectedLanguage=t}return U(e.detectedLanguage,e.responseLanguage),e}async function W(e,t){if("en"===t)e.responseLanguage=t,e.detectedLanguage="ru";else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return U(e.detectedLanguage,e.responseLanguage),e}function G(){o.pause(),p.removeEventListener(".translate",G,!1),o.src="",o.removeAttribute("src"),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)y.Z.log(`lipsync mode is ${e}`),o.pause(),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(ee=await Y(ee,ee.detectedLanguage),y.Z.log("VideoValidator videoData: ",Z),1===z&&ee.detectedLanguage===b)throw $=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if(Z.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,Z.detectedLanguage,Z.responseLanguage)};function ne(e){y.Z.log(`video ${e.type}`),J(e.type)}function oe(){G(),K()}function ae(t,a,i){!function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(`${v.g$[u]}${t}`,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),$=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),X(),function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,n)))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!$||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),$=!1}catch(e){O("error",String(e).substring(4,e.length)),$=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),$.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(Z);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const $={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},Z=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,$=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let Z=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",Z);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:Z.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:Z.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),Z=await Y(Z,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),Z=await W(Z,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}function U(e,t=b){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t)}async function Y(e,t){switch(t){case"en":e.detectedLanguage=t,e.responseLanguage=b;break;case"ru":e.detectedLanguage=t,e.responseLanguage=b,"ru"==b&&(e.responseLanguage="en");break;default:if(!Object.keys(v.tW).includes(t))return Y(e,"en");e.detectedLanguage=t}return U(e.detectedLanguage,e.responseLanguage),e}async function W(e,t){if("en"===t)e.responseLanguage=t,e.detectedLanguage="ru";else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)y.Z.log(`lipsync mode is ${e}`),o.pause(),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(ee=await Y(ee,ee.detectedLanguage),y.Z.log("VideoValidator videoData: ",Z),1===z&&ee.detectedLanguage===b)throw $=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if(Z.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),ae(e,Z.detectedLanguage,Z.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}function ae(t,a,i){!function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(`${v.g$[u]}${t}`,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),$=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!$||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),$=!1}catch(e){O("error",String(e).substring(4,e.length)),$=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),$.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(Z);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot-cloudflare.user.js b/dist/vot-cloudflare.user.js index cc032ee9..87b53eac 100644 --- a/dist/vot-cloudflare.user.js +++ b/dist/vot-cloudflare.user.js @@ -80,7 +80,7 @@ // @icon https://translate.yandex.ru/icons/favicon.ico // @inject-into page // @namespace vot-cloudflare -// @require https://cdnjs.cloudflare.com/ajax/libs/protobufjs/7.2.3/protobuf.min.js +// @require https://cdnjs.cloudflare.com/ajax/libs/protobufjs/7.2.3/light/protobuf.min.js // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js // ==/UserScript== @@ -2538,7 +2538,7 @@ async function src_main() { event.stopPropagation(); } - const deleteAudioSrc = () => { + const deleteAudioSrc = async () => { audio.src = ""; audio.removeAttribute("src"); }; @@ -3020,11 +3020,11 @@ async function src_main() { return data; } - function stopTraslate() { + async function stopTraslate() { // Default actions on stop translate audio.pause(); video.removeEventListener(".translate", stopTraslate, false); - deleteAudioSrc(); + await deleteAudioSrc(); document.querySelector("#VOTVideoSlider")?.parentElement.remove(); document.querySelector("#VOTTranslationSlider")?.parentElement.remove(); const downloadBtn = document.querySelector(".translationDownload"); @@ -3036,7 +3036,7 @@ async function src_main() { } } - function syncVideoVolumeSlider() { + async function syncVideoVolumeSlider() { // Sync volume slider with original video (youtube only) const newSlidersVolume = document .querySelector(".ytp-volume-panel") @@ -3089,7 +3089,7 @@ async function src_main() { return videoData; } - const lipSync = (mode = false) => { + const lipSync = async (mode = false) => { debug/* default */.Z.log("lipsync video", video); if (!video) { return; @@ -3135,7 +3135,7 @@ async function src_main() { } }; - function addVideoSlider() { + async function addVideoSlider() { if ( dbShowVideoSlider !== 1 || document.querySelector("#VOTVideoSlider") || @@ -3159,7 +3159,7 @@ async function src_main() { `${constants/* translations */.Iz[lang].VOTVolume}: ${newVolume}%` ); - slider.querySelector("#VOTVideoSlider").oninput = (event) => { + slider.querySelector("#VOTVideoSlider").oninput = async (event) => { const { value } = event.target; video.volume = value / 100; slider.querySelector("#VOTOriginalVolume").innerText = `${value}%`; @@ -3202,7 +3202,7 @@ async function src_main() { menuOptions.appendChild(slider); } - function addTranslationSlider() { + async function addTranslationSlider() { // Return early if slider already exists or translation is not successful if ( document.querySelector("#VOTTranslationSlider") || @@ -3306,7 +3306,7 @@ async function src_main() { debug/* default */.Z.log("Run videoValidator"); await videoValidator(); debug/* default */.Z.log("Run translateFunc"); - await translateFunc( + translateFunc( VIDEO_ID, videoData.detectedLanguage, videoData.responseLanguage @@ -3314,15 +3314,15 @@ async function src_main() { }; // Define a function to handle common events - function handleVideoEvent(event) { + async function handleVideoEvent(event) { debug/* default */.Z.log(`video ${event.type}`); - lipSync(event.type); + await lipSync(event.type); } // Define a function to stop translation and clean up - function stopTranslation() { - stopTraslate(); - syncVideoVolumeSlider(); + async function stopTranslation() { + await stopTraslate(); + await syncVideoVolumeSlider(); } // Define a function to translate a video and handle the callback @@ -3443,8 +3443,8 @@ async function src_main() { events.forEach((e) => v.addEventListener(e, handleVideoEvent)) ); transformBtn("success", constants/* translations */.Iz[lang].disableTranslate); - addVideoSlider(); - addTranslationSlider(); + await addVideoSlider(); + await addTranslationSlider(); const VOTVideoSlider = document.querySelector("#VOTVideoSlider"); if (VOTVideoSlider) VOTVideoSlider.value = config/* autoVolume */.IM * 100; @@ -3462,7 +3462,7 @@ async function src_main() { ); } - document.addEventListener("click", (event) => { + document.addEventListener("click", async (event) => { const block = document.querySelector(".translationBlock"); const menuContainer = document.querySelector(".translationMenuContent"); const isBlock = @@ -3485,7 +3485,11 @@ async function src_main() { }); const addEventListeners = (element, events, handler) => { - events.forEach((event) => element.addEventListener(event, handler)); + events.forEach((event) => + element.addEventListener(event, async (event) => { + await handler(event); + }) + ); }; if (siteHostname === "pornhub") { @@ -3542,7 +3546,7 @@ async function src_main() { // check if the audio source is not empty if (audio.src) { debug/* default */.Z.log("[click translationBtn] audio.src is not empty"); - stopTraslate(); + await stopTraslate(); return; } diff --git a/dist/vot-min.user.js b/dist/vot-min.user.js index 87ab71a7..2d1af2a6 100644 --- a/dist/vot-min.user.js +++ b/dist/vot-min.user.js @@ -79,8 +79,8 @@ // @homepageURL https://github.com/ilyhalight/voice-over-translation/issues // @icon https://translate.yandex.ru/icons/favicon.ico // @namespace vot -// @require https://cdnjs.cloudflare.com/ajax/libs/protobufjs/7.2.3/protobuf.min.js +// @require https://cdnjs.cloudflare.com/ajax/libs/protobufjs/7.2.3/light/protobuf.min.js // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>a,IM:()=>r,Rr:()=>i,iF:()=>o});const o="api.browser.yandex.ru",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var a=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=o(!0),d=a.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},b={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},y={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function k(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function L(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function F(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in y||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${y[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=y[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(B);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,z)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=y[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=y[V].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=y[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=y[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=y[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${y[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${y[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:y[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:y[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:y[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:y[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),o=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),_=await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=y[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=y[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(y[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),j(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=y[V].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=x("VOTAutoTranslate",O,y[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${y[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=x("VOTDontTranslateYourLang",E,y[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=x("VOTAutoSetVolume",M,y[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=x("VOTShowVideoSlider",D,y[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=x("VOTSyncVolume",I,y[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}function Y(e,t=V){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t)}async function G(e,t){switch(t){case"en":e.detectedLanguage=t,e.responseLanguage=V;break;case"ru":e.detectedLanguage=t,e.responseLanguage=V,"ru"==V&&(e.responseLanguage="en");break;default:if(!Object.keys(v).includes(t))return G(e,"en");e.detectedLanguage=t}return Y(e.detectedLanguage,e.responseLanguage),e}async function W(e,t){if("en"===t)e.responseLanguage=t,e.detectedLanguage="ru";else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return Y(e.detectedLanguage,e.responseLanguage),e}function Z(){o.pause(),c.removeEventListener(".translate",Z,!1),o.src="",o.removeAttribute("src"),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",k("none",y[V].translateVideo),m&&(c.volume=m)}function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}k("none",y[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=(e=!1)=>{if(f.log("lipsync video",c),c)if(o.currentTime=c.currentTime,o.playbackRate=c.playbackRate,e)if("play"!==e)f.log(`lipsync mode is ${e}`),o.pause(),"playing"===e&&(f.log("lipsync mode is playing"),o.play());else{f.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=y[V].grantPermissionToAutoPlay;throw k("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?y[V].neededAdditionalExtension:y[V].audioFormatNotSupported;throw k("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${y[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=$(o,n,i,g);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(te=await G(te,te.detectedLanguage),f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V)throw z=!1,y[V].VOTDisableFromYourLang;if(te.isLive)throw y[V].VOTLiveNotSupported;if(te.isPremiere)throw y[V].VOTPremiere;if(_.duration>14400)throw y[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await ae(e,_.detectedLanguage,_.responseLanguage)};function ne(e){f.log(`video ${e.type}`),J(e.type)}function oe(){Z(),K()}function ae(t,a,i){!function(t,n,o,a,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),e(t,n,o,a,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,y[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||y[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?y[V].translationTakeMoreThanHour:t>=10&&t%10?y[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?y[V].translationTakeAboutMinute:y[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):y[V].translationTakeFewMinutes);break;case 3:i(!1,y[V].videoBeingTranslated)}}))}(`${b[d]}${t}`,0x4075500000000000,a,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw k("error",r),r.includes(y[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>ae(t,a,i)),6e4)),r;switch(o.src=r,m=c?.volume,"number"==typeof S&&(o.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(oe(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),k("success",y[V].disableTranslate),X(),function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${y[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=$(c,e,n,w);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),g=o,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const b=document.querySelector(".translationDownload");b.href=r,b.style.display="initial"}))}document.addEventListener("click",(e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${a} ${s} ${l}`),a||s||(l||r(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,n)))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,a))),document.addEventListener("touchstart",(e=>l(e,t,a))),document.addEventListener("touchmove",(e=>l(e,t,a))),document.addEventListener("touchend",(e=>l(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return f.log("[click translationBtn] audio.src is not empty"),void Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw y[V].VOTNoVideoIDFound;await Q(e)}catch(e){k("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw y[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){k("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function k(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function x(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),_=await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=x("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=x("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=x("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=x("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=x("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}function Y(e,t=V){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t)}async function G(e,t){switch(t){case"en":e.detectedLanguage=t,e.responseLanguage=V;break;case"ru":e.detectedLanguage=t,e.responseLanguage=V,"ru"==V&&(e.responseLanguage="en");break;default:if(!Object.keys(v).includes(t))return G(e,"en");e.detectedLanguage=t}return Y(e.detectedLanguage,e.responseLanguage),e}async function W(e,t){if("en"===t)e.responseLanguage=t,e.detectedLanguage="ru";else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",k("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}k("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)f.log(`lipsync mode is ${e}`),a.pause(),"playing"===e&&(f.log("lipsync mode is playing"),a.play());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw k("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw k("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(te=await G(te,te.detectedLanguage),f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}function oe(t,o,i){!function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(`${y[d]}${t}`,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw k("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),k("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){k("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){k("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot.user.js b/dist/vot.user.js index 29f16920..c71ae6dd 100644 --- a/dist/vot.user.js +++ b/dist/vot.user.js @@ -79,7 +79,7 @@ // @homepageURL https://github.com/ilyhalight/voice-over-translation/issues // @icon https://translate.yandex.ru/icons/favicon.ico // @namespace vot -// @require https://cdnjs.cloudflare.com/ajax/libs/protobufjs/7.2.3/protobuf.min.js +// @require https://cdnjs.cloudflare.com/ajax/libs/protobufjs/7.2.3/light/protobuf.min.js // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js // ==/UserScript== @@ -2489,7 +2489,7 @@ async function src_main() { event.stopPropagation(); } - const deleteAudioSrc = () => { + const deleteAudioSrc = async () => { audio.src = ""; audio.removeAttribute("src"); }; @@ -2949,11 +2949,11 @@ async function src_main() { return data; } - function stopTraslate() { + async function stopTraslate() { // Default actions on stop translate audio.pause(); video.removeEventListener(".translate", stopTraslate, false); - deleteAudioSrc(); + await deleteAudioSrc(); document.querySelector("#VOTVideoSlider")?.parentElement.remove(); document.querySelector("#VOTTranslationSlider")?.parentElement.remove(); const downloadBtn = document.querySelector(".translationDownload"); @@ -2965,7 +2965,7 @@ async function src_main() { } } - function syncVideoVolumeSlider() { + async function syncVideoVolumeSlider() { // Sync volume slider with original video (youtube only) const newSlidersVolume = document .querySelector(".ytp-volume-panel") @@ -3018,7 +3018,7 @@ async function src_main() { return videoData; } - const lipSync = (mode = false) => { + const lipSync = async (mode = false) => { utils_debug.log("lipsync video", video); if (!video) { return; @@ -3064,7 +3064,7 @@ async function src_main() { } }; - function addVideoSlider() { + async function addVideoSlider() { if ( dbShowVideoSlider !== 1 || document.querySelector("#VOTVideoSlider") || @@ -3088,7 +3088,7 @@ async function src_main() { `${translations[lang].VOTVolume}: ${newVolume}%` ); - slider.querySelector("#VOTVideoSlider").oninput = (event) => { + slider.querySelector("#VOTVideoSlider").oninput = async (event) => { const { value } = event.target; video.volume = value / 100; slider.querySelector("#VOTOriginalVolume").innerText = `${value}%`; @@ -3131,7 +3131,7 @@ async function src_main() { menuOptions.appendChild(slider); } - function addTranslationSlider() { + async function addTranslationSlider() { // Return early if slider already exists or translation is not successful if ( document.querySelector("#VOTTranslationSlider") || @@ -3235,7 +3235,7 @@ async function src_main() { utils_debug.log("Run videoValidator"); await videoValidator(); utils_debug.log("Run translateFunc"); - await translateFunc( + translateFunc( VIDEO_ID, videoData.detectedLanguage, videoData.responseLanguage @@ -3243,15 +3243,15 @@ async function src_main() { }; // Define a function to handle common events - function handleVideoEvent(event) { + async function handleVideoEvent(event) { utils_debug.log(`video ${event.type}`); - lipSync(event.type); + await lipSync(event.type); } // Define a function to stop translation and clean up - function stopTranslation() { - stopTraslate(); - syncVideoVolumeSlider(); + async function stopTranslation() { + await stopTraslate(); + await syncVideoVolumeSlider(); } // Define a function to translate a video and handle the callback @@ -3362,8 +3362,8 @@ async function src_main() { events.forEach((e) => v.addEventListener(e, handleVideoEvent)) ); transformBtn("success", translations[lang].disableTranslate); - addVideoSlider(); - addTranslationSlider(); + await addVideoSlider(); + await addTranslationSlider(); const VOTVideoSlider = document.querySelector("#VOTVideoSlider"); if (VOTVideoSlider) VOTVideoSlider.value = config/* autoVolume */.IM * 100; @@ -3381,7 +3381,7 @@ async function src_main() { ); } - document.addEventListener("click", (event) => { + document.addEventListener("click", async (event) => { const block = document.querySelector(".translationBlock"); const menuContainer = document.querySelector(".translationMenuContent"); const isBlock = @@ -3404,7 +3404,11 @@ async function src_main() { }); const addEventListeners = (element, events, handler) => { - events.forEach((event) => element.addEventListener(event, handler)); + events.forEach((event) => + element.addEventListener(event, async (event) => { + await handler(event); + }) + ); }; if (siteHostname === "pornhub") { @@ -3461,7 +3465,7 @@ async function src_main() { // check if the audio source is not empty if (audio.src) { utils_debug.log("[click translationBtn] audio.src is not empty"); - stopTraslate(); + await stopTraslate(); return; } diff --git a/src/headers.json b/src/headers.json index 1a7a8cab..04533eec 100644 --- a/src/headers.json +++ b/src/headers.json @@ -68,7 +68,7 @@ "*://my.mail.ru/*" ], "require": [ - "https://cdnjs.cloudflare.com/ajax/libs/protobufjs/7.2.3/protobuf.min.js" + "https://cdnjs.cloudflare.com/ajax/libs/protobufjs/7.2.3/light/protobuf.min.js" ], "grant": ["GM_xmlhttpRequest", "GM_info"], "connect": ["api.browser.yandex.ru"] diff --git a/src/index.js b/src/index.js index 57e9b1dc..cc1f5618 100644 --- a/src/index.js +++ b/src/index.js @@ -98,7 +98,7 @@ async function main() { event.stopPropagation(); } - const deleteAudioSrc = () => { + const deleteAudioSrc = async () => { audio.src = ""; audio.removeAttribute("src"); }; @@ -580,11 +580,11 @@ async function main() { return data; } - function stopTraslate() { + async function stopTraslate() { // Default actions on stop translate audio.pause(); video.removeEventListener(".translate", stopTraslate, false); - deleteAudioSrc(); + await deleteAudioSrc(); document.querySelector("#VOTVideoSlider")?.parentElement.remove(); document.querySelector("#VOTTranslationSlider")?.parentElement.remove(); const downloadBtn = document.querySelector(".translationDownload"); @@ -596,7 +596,7 @@ async function main() { } } - function syncVideoVolumeSlider() { + async function syncVideoVolumeSlider() { // Sync volume slider with original video (youtube only) const newSlidersVolume = document .querySelector(".ytp-volume-panel") @@ -649,7 +649,7 @@ async function main() { return videoData; } - const lipSync = (mode = false) => { + const lipSync = async (mode = false) => { debug.log("lipsync video", video); if (!video) { return; @@ -695,7 +695,7 @@ async function main() { } }; - function addVideoSlider() { + async function addVideoSlider() { if ( dbShowVideoSlider !== 1 || document.querySelector("#VOTVideoSlider") || @@ -719,7 +719,7 @@ async function main() { `${translations[lang].VOTVolume}: ${newVolume}%` ); - slider.querySelector("#VOTVideoSlider").oninput = (event) => { + slider.querySelector("#VOTVideoSlider").oninput = async (event) => { const { value } = event.target; video.volume = value / 100; slider.querySelector("#VOTOriginalVolume").innerText = `${value}%`; @@ -762,7 +762,7 @@ async function main() { menuOptions.appendChild(slider); } - function addTranslationSlider() { + async function addTranslationSlider() { // Return early if slider already exists or translation is not successful if ( document.querySelector("#VOTTranslationSlider") || @@ -866,7 +866,7 @@ async function main() { debug.log("Run videoValidator"); await videoValidator(); debug.log("Run translateFunc"); - await translateFunc( + translateFunc( VIDEO_ID, videoData.detectedLanguage, videoData.responseLanguage @@ -874,15 +874,15 @@ async function main() { }; // Define a function to handle common events - function handleVideoEvent(event) { + async function handleVideoEvent(event) { debug.log(`video ${event.type}`); - lipSync(event.type); + await lipSync(event.type); } // Define a function to stop translation and clean up - function stopTranslation() { - stopTraslate(); - syncVideoVolumeSlider(); + async function stopTranslation() { + await stopTraslate(); + await syncVideoVolumeSlider(); } // Define a function to translate a video and handle the callback @@ -1003,8 +1003,8 @@ async function main() { events.forEach((e) => v.addEventListener(e, handleVideoEvent)) ); transformBtn("success", translations[lang].disableTranslate); - addVideoSlider(); - addTranslationSlider(); + await addVideoSlider(); + await addTranslationSlider(); const VOTVideoSlider = document.querySelector("#VOTVideoSlider"); if (VOTVideoSlider) VOTVideoSlider.value = autoVolume * 100; @@ -1022,7 +1022,7 @@ async function main() { ); } - document.addEventListener("click", (event) => { + document.addEventListener("click", async (event) => { const block = document.querySelector(".translationBlock"); const menuContainer = document.querySelector(".translationMenuContent"); const isBlock = @@ -1045,7 +1045,11 @@ async function main() { }); const addEventListeners = (element, events, handler) => { - events.forEach((event) => element.addEventListener(event, handler)); + events.forEach((event) => + element.addEventListener(event, async (event) => { + await handler(event); + }) + ); }; if (siteHostname === "pornhub") { @@ -1102,7 +1106,7 @@ async function main() { // check if the audio source is not empty if (audio.src) { debug.log("[click translationBtn] audio.src is not empty"); - stopTraslate(); + await stopTraslate(); return; } From 4abbf98288f92f0d9928943836c955d20eeb3cb0 Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Tue, 25 Jul 2023 22:08:00 +0400 Subject: [PATCH 11/48] =?UTF-8?q?=D0=A3=D0=BB=D1=83=D1=87=D1=88=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20lipsync?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Теперь при abort происходит остановка перевода --- dist/vot-cloudflare-min.user.js | 2 +- dist/vot-cloudflare.user.js | 13 ++++++++----- dist/vot-min.user.js | 2 +- dist/vot.user.js | 13 ++++++++----- src/index.js | 14 +++++++++----- 5 files changed, 27 insertions(+), 17 deletions(-) diff --git a/dist/vot-cloudflare-min.user.js b/dist/vot-cloudflare-min.user.js index e18c40c6..a9daeab6 100644 --- a/dist/vot-cloudflare-min.user.js +++ b/dist/vot-cloudflare-min.user.js @@ -84,4 +84,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const $={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},Z=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,$=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let Z=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",Z);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:Z.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:Z.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),Z=await Y(Z,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),Z=await W(Z,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}function U(e,t=b){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t)}async function Y(e,t){switch(t){case"en":e.detectedLanguage=t,e.responseLanguage=b;break;case"ru":e.detectedLanguage=t,e.responseLanguage=b,"ru"==b&&(e.responseLanguage="en");break;default:if(!Object.keys(v.tW).includes(t))return Y(e,"en");e.detectedLanguage=t}return U(e.detectedLanguage,e.responseLanguage),e}async function W(e,t){if("en"===t)e.responseLanguage=t,e.detectedLanguage="ru";else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)y.Z.log(`lipsync mode is ${e}`),o.pause(),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(ee=await Y(ee,ee.detectedLanguage),y.Z.log("VideoValidator videoData: ",Z),1===z&&ee.detectedLanguage===b)throw $=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if(Z.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),ae(e,Z.detectedLanguage,Z.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}function ae(t,a,i){!function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(`${v.g$[u]}${t}`,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),$=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!$||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),$=!1}catch(e){O("error",String(e).substring(4,e.length)),$=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),$.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(Z);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),$=await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}function U(e,t=b){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t)}async function Y(e,t){switch(t){case"en":e.detectedLanguage=t,e.responseLanguage=b;break;case"ru":e.detectedLanguage=t,e.responseLanguage=b,"ru"==b&&(e.responseLanguage="en");break;default:if(!Object.keys(v.tW).includes(t))return Y(e,"en");e.detectedLanguage=t}return U(e.detectedLanguage,e.responseLanguage),e}async function W(e,t){if("en"===t)e.responseLanguage=t,e.detectedLanguage="ru";else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)y.Z.log(`lipsync mode is ${e}`),o.pause(),"abort"===e&&(y.Z.log("lipsync mode is abort"),await oe()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(ee=await Y(ee,ee.detectedLanguage),y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===b)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}function ae(t,a,i){!async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(`${v.g$[u]}${t}`,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot-cloudflare.user.js b/dist/vot-cloudflare.user.js index 87b53eac..88ac9e74 100644 --- a/dist/vot-cloudflare.user.js +++ b/dist/vot-cloudflare.user.js @@ -2572,7 +2572,7 @@ async function src_main() { debug/* default */.Z.log("VOT: Added translation menu to ", element); } - function translateVideo(url, unknown1, requestLang, responseLang, callback) { + async function translateVideo(url, unknown1, requestLang, responseLang, callback) { debug/* default */.Z.log( `Translate video (url: ${url}, unknown1: ${unknown1}, requestLang: ${requestLang}, responseLang: ${responseLang})` ); @@ -3125,10 +3125,14 @@ async function src_main() { } return; } - if (mode === "pause" || "stop" || 0 || 0) { + if (mode === "pause" || "waiting" || 0) { debug/* default */.Z.log(`lipsync mode is ${mode}`); audio.pause(); } + if (mode === "abort") { + debug/* default */.Z.log("lipsync mode is abort"); + await stopTranslation(); + } if (mode === "playing") { debug/* default */.Z.log("lipsync mode is playing"); audio.play(); @@ -3239,7 +3243,7 @@ async function src_main() { // Sync translation volume with video volume if dbSyncVolume is 1 if (dbSyncVolume === 1) { - syncTranslationWithVideo(value); + await syncTranslationWithVideo(value); } }; @@ -3249,7 +3253,7 @@ async function src_main() { } // A helper function to sync translation volume with video volume - function syncTranslationWithVideo(translationValue) { + async function syncTranslationWithVideo(translationValue) { // Get the video volume slider element const videoVolumeSlider = document.querySelector("#VOTVideoSlider"); @@ -3893,7 +3897,6 @@ async function src_main() { src_main().catch((e) => { console.error(e); }); - })(); /******/ })() diff --git a/dist/vot-min.user.js b/dist/vot-min.user.js index 2d1af2a6..7b607581 100644 --- a/dist/vot-min.user.js +++ b/dist/vot-min.user.js @@ -83,4 +83,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function k(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function x(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),_=await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=x("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=x("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=x("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=x("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=x("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}function Y(e,t=V){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t)}async function G(e,t){switch(t){case"en":e.detectedLanguage=t,e.responseLanguage=V;break;case"ru":e.detectedLanguage=t,e.responseLanguage=V,"ru"==V&&(e.responseLanguage="en");break;default:if(!Object.keys(v).includes(t))return G(e,"en");e.detectedLanguage=t}return Y(e.detectedLanguage,e.responseLanguage),e}async function W(e,t){if("en"===t)e.responseLanguage=t,e.detectedLanguage="ru";else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",k("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}k("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)f.log(`lipsync mode is ${e}`),a.pause(),"playing"===e&&(f.log("lipsync mode is playing"),a.play());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw k("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw k("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(te=await G(te,te.detectedLanguage),f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}function oe(t,o,i){!function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(`${y[d]}${t}`,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw k("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),k("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){k("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){k("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function k(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function x(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),_=await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=x("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=x("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=x("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=x("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=x("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}function Y(e,t=V){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t)}async function G(e,t){switch(t){case"en":e.detectedLanguage=t,e.responseLanguage=V;break;case"ru":e.detectedLanguage=t,e.responseLanguage=V,"ru"==V&&(e.responseLanguage="en");break;default:if(!Object.keys(v).includes(t))return G(e,"en");e.detectedLanguage=t}return Y(e.detectedLanguage,e.responseLanguage),e}async function W(e,t){if("en"===t)e.responseLanguage=t,e.detectedLanguage="ru";else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",k("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}k("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)f.log(`lipsync mode is ${e}`),a.pause(),"abort"===e&&(f.log("lipsync mode is abort"),await ae()),"playing"===e&&(f.log("lipsync mode is playing"),a.play());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw k("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw k("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(te=await G(te,te.detectedLanguage),f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}function oe(t,o,i){!async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(`${y[d]}${t}`,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw k("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),k("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){k("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){k("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot.user.js b/dist/vot.user.js index c71ae6dd..4e409482 100644 --- a/dist/vot.user.js +++ b/dist/vot.user.js @@ -2523,7 +2523,7 @@ async function src_main() { utils_debug.log("VOT: Added translation menu to ", element); } - function translateVideo(url, unknown1, requestLang, responseLang, callback) { + async function translateVideo(url, unknown1, requestLang, responseLang, callback) { utils_debug.log( `Translate video (url: ${url}, unknown1: ${unknown1}, requestLang: ${requestLang}, responseLang: ${responseLang})` ); @@ -3054,10 +3054,14 @@ async function src_main() { } return; } - if (mode === "pause" || "stop" || 0 || 0) { + if (mode === "pause" || "waiting" || 0) { utils_debug.log(`lipsync mode is ${mode}`); audio.pause(); } + if (mode === "abort") { + utils_debug.log("lipsync mode is abort"); + await stopTranslation(); + } if (mode === "playing") { utils_debug.log("lipsync mode is playing"); audio.play(); @@ -3168,7 +3172,7 @@ async function src_main() { // Sync translation volume with video volume if dbSyncVolume is 1 if (dbSyncVolume === 1) { - syncTranslationWithVideo(value); + await syncTranslationWithVideo(value); } }; @@ -3178,7 +3182,7 @@ async function src_main() { } // A helper function to sync translation volume with video volume - function syncTranslationWithVideo(translationValue) { + async function syncTranslationWithVideo(translationValue) { // Get the video volume slider element const videoVolumeSlider = document.querySelector("#VOTVideoSlider"); @@ -3812,7 +3816,6 @@ async function src_main() { src_main().catch((e) => { console.error(e); }); - })(); /******/ })() diff --git a/src/index.js b/src/index.js index cc1f5618..30a74dd7 100644 --- a/src/index.js +++ b/src/index.js @@ -132,7 +132,7 @@ async function main() { debug.log("VOT: Added translation menu to ", element); } - function translateVideo(url, unknown1, requestLang, responseLang, callback) { + async function translateVideo(url, unknown1, requestLang, responseLang, callback) { debug.log( `Translate video (url: ${url}, unknown1: ${unknown1}, requestLang: ${requestLang}, responseLang: ${responseLang})` ); @@ -685,10 +685,14 @@ async function main() { } return; } - if (mode === "pause" || "stop" || "waiting" || "abort") { + if (mode === "pause" || "waiting" || "stop") { debug.log(`lipsync mode is ${mode}`); audio.pause(); } + if (mode === "abort") { + debug.log("lipsync mode is abort"); + await stopTranslation(); + } if (mode === "playing") { debug.log("lipsync mode is playing"); audio.play(); @@ -799,7 +803,7 @@ async function main() { // Sync translation volume with video volume if dbSyncVolume is 1 if (dbSyncVolume === 1) { - syncTranslationWithVideo(value); + await syncTranslationWithVideo(value); } }; @@ -809,7 +813,7 @@ async function main() { } // A helper function to sync translation volume with video volume - function syncTranslationWithVideo(translationValue) { + async function syncTranslationWithVideo(translationValue) { // Get the video volume slider element const videoVolumeSlider = document.querySelector("#VOTVideoSlider"); @@ -1452,4 +1456,4 @@ async function main() { main().catch((e) => { console.error(e); -}); +}); \ No newline at end of file From 33826f188a605bd04475e735bad7488fda86e96a Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Wed, 26 Jul 2023 21:56:56 +0400 Subject: [PATCH 12/48] =?UTF-8?q?=D0=9F=D0=BE=D0=BF=D1=8B=D1=82=D0=BA?= =?UTF-8?q?=D0=B0=20=D1=84=D0=B8=D0=BA=D1=81=D0=B0=20=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D1=8E=20(=D0=BD=D0=B5=D0=BF=D0=BE=D0=BB=D0=BD=D0=B0=D1=8F)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Попытался улучшить выбор языка --- dist/vot-cloudflare-min.user.js | 2 +- dist/vot-cloudflare.user.js | 16 +++++++++++----- dist/vot-min.user.js | 2 +- dist/vot.user.js | 16 +++++++++++----- src/index.js | 16 +++++++++++----- 5 files changed, 35 insertions(+), 17 deletions(-) diff --git a/dist/vot-cloudflare-min.user.js b/dist/vot-cloudflare-min.user.js index a9daeab6..e8aaf61e 100644 --- a/dist/vot-cloudflare-min.user.js +++ b/dist/vot-cloudflare-min.user.js @@ -84,4 +84,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),$=await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}function U(e,t=b){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t)}async function Y(e,t){switch(t){case"en":e.detectedLanguage=t,e.responseLanguage=b;break;case"ru":e.detectedLanguage=t,e.responseLanguage=b,"ru"==b&&(e.responseLanguage="en");break;default:if(!Object.keys(v.tW).includes(t))return Y(e,"en");e.detectedLanguage=t}return U(e.detectedLanguage,e.responseLanguage),e}async function W(e,t){if("en"===t)e.responseLanguage=t,e.detectedLanguage="ru";else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)y.Z.log(`lipsync mode is ${e}`),o.pause(),"abort"===e&&(y.Z.log("lipsync mode is abort"),await oe()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(ee=await Y(ee,ee.detectedLanguage),y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===b)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}function ae(t,a,i){!async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(`${v.g$[u]}${t}`,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="",te=b;(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),$=await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}function U(e){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${te}`),document.querySelector("#VOTTranslateFromLang").value=e,te=document.querySelector("#VOTTranslateToLang").value)}async function Y(e,t){switch(t){case"en":e.detectedLanguage=t,e.responseLanguage=te;break;case"ru":e.detectedLanguage=t,e.responseLanguage=te,"ru"==b&&(e.responseLanguage="en");break;default:if(!Object.keys(v.tW).includes(t))return Y(e,"en");e.detectedLanguage=t}return U(e.detectedLanguage,e.responseLanguage),e}async function W(e,t){if("en"===t)e.responseLanguage=t,e.detectedLanguage="ru";else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)y.Z.log(`lipsync mode is ${e}`),o.pause(),"abort"===e&&(y.Z.log("lipsync mode is abort"),await ae()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const ne=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(ee=await Y(ee,ee.detectedLanguage),y.Z.log("VideoValidator videoData: ",$),console.log("VOT TEST",te),1===z&&ee.detectedLanguage===b||ee.detectedLanguage===te)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),ie(e,$.detectedLanguage,$.responseLanguage)};async function oe(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function ae(){await G(),await K()}function ie(t,a,i){!async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(`${v.g$[u]}${t}`,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ie(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(ae(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,oe))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const re=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?re(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&re(document.querySelector("#player"),["mousemove","mouseout"],l):re("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await ne(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await ne(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot-cloudflare.user.js b/dist/vot-cloudflare.user.js index 88ac9e74..fc0430b5 100644 --- a/dist/vot-cloudflare.user.js +++ b/dist/vot-cloudflare.user.js @@ -2485,6 +2485,8 @@ let translateToLang = "ru"; // default language of audio response let ytData = ""; +let to = lang + async function src_main() { debug/* default */.Z.log("Loading extension..."); debug/* default */.Z.log(`Selected menu language: ${lang}`); @@ -2734,6 +2736,7 @@ async function src_main() { selectFromLang.appendChild(selectToLang); menuOptions.appendChild(selectFromLang); + menuOptions .querySelector("#VOTTranslateFromLang") .addEventListener("change", async (event) => { @@ -2962,25 +2965,27 @@ async function src_main() { }); } - function setSelectMenuValues(from, to = lang) { + + function setSelectMenuValues(from) { if (!document.querySelector("#VOTSelectLanguages")) { return; } console.log(`Set translation from ${from} to ${to}`); document.querySelector("#VOTTranslateFromLang").value = from; - document.querySelector("#VOTTranslateToLang").value = to; + to = document.querySelector("#VOTTranslateToLang").value; } + // data - ytData or VideoData async function setDetectedLangauge(data, videolang) { switch (videolang) { case "en": data.detectedLanguage = videolang; - data.responseLanguage = lang; + data.responseLanguage = to; break; case "ru": data.detectedLanguage = videolang; - data.responseLanguage = lang; + data.responseLanguage = to; if (lang == "ru") data.responseLanguage = "en"; break; default: @@ -3287,7 +3292,8 @@ async function src_main() { if (window.location.hostname.includes("youtube.com")) { ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); debug/* default */.Z.log("VideoValidator videoData: ", videoData); - if (dontTranslateYourLang === 1 && ytData.detectedLanguage === lang) { + console.log("VOT TEST", to) + if (dontTranslateYourLang === 1 && ytData.detectedLanguage === lang || ytData.detectedLanguage === to) { firstPlay = false; throw constants/* translations */.Iz[lang].VOTDisableFromYourLang; } diff --git a/dist/vot-min.user.js b/dist/vot-min.user.js index 7b607581..e40bb04a 100644 --- a/dist/vot-min.user.js +++ b/dist/vot-min.user.js @@ -83,4 +83,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function k(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function x(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),_=await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=x("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=x("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=x("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=x("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=x("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}function Y(e,t=V){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t)}async function G(e,t){switch(t){case"en":e.detectedLanguage=t,e.responseLanguage=V;break;case"ru":e.detectedLanguage=t,e.responseLanguage=V,"ru"==V&&(e.responseLanguage="en");break;default:if(!Object.keys(v).includes(t))return G(e,"en");e.detectedLanguage=t}return Y(e.detectedLanguage,e.responseLanguage),e}async function W(e,t){if("en"===t)e.responseLanguage=t,e.detectedLanguage="ru";else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",k("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}k("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)f.log(`lipsync mode is ${e}`),a.pause(),"abort"===e&&(f.log("lipsync mode is abort"),await ae()),"playing"===e&&(f.log("lipsync mode is playing"),a.play());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw k("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw k("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(te=await G(te,te.detectedLanguage),f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}function oe(t,o,i){!async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(`${y[d]}${t}`,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw k("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),k("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){k("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){k("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function k(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function x(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="",ne=V;(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),_=await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=x("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=x("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=x("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=x("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=x("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}function Y(e){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${ne}`),document.querySelector("#VOTTranslateFromLang").value=e,ne=document.querySelector("#VOTTranslateToLang").value)}async function G(e,t){switch(t){case"en":e.detectedLanguage=t,e.responseLanguage=ne;break;case"ru":e.detectedLanguage=t,e.responseLanguage=ne,"ru"==V&&(e.responseLanguage="en");break;default:if(!Object.keys(v).includes(t))return G(e,"en");e.detectedLanguage=t}return Y(e.detectedLanguage,e.responseLanguage),e}async function W(e,t){if("en"===t)e.responseLanguage=t,e.detectedLanguage="ru";else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",k("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}k("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)f.log(`lipsync mode is ${e}`),a.pause(),"abort"===e&&(f.log("lipsync mode is abort"),await oe()),"playing"===e&&(f.log("lipsync mode is playing"),a.play());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw k("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw k("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(te=await G(te,te.detectedLanguage),f.log("VideoValidator videoData: ",_),console.log("VOT TEST",ne),1===E&&te.detectedLanguage===V||te.detectedLanguage===ne)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),ie(e,_.detectedLanguage,_.responseLanguage)};async function ae(e){f.log(`video ${e.type}`),await J(e.type)}async function oe(){await Z(),await K()}function ie(t,o,i){!async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(`${y[d]}${t}`,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw k("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>ie(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(oe(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ae))))),k("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const re=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?re(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&re(document.querySelector("#player"),["mousemove","mouseout"],s):re("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){k("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){k("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot.user.js b/dist/vot.user.js index 4e409482..37dbb625 100644 --- a/dist/vot.user.js +++ b/dist/vot.user.js @@ -2430,6 +2430,8 @@ let translateToLang = "ru"; // default language of audio response let ytData = ""; +let to = lang + async function src_main() { utils_debug.log("Loading extension..."); utils_debug.log(`Selected menu language: ${lang}`); @@ -2682,6 +2684,7 @@ async function src_main() { selectFromLang.appendChild(selectToLang); menuOptions.appendChild(selectFromLang); + menuOptions .querySelector("#VOTTranslateFromLang") .addEventListener("change", async (event) => { @@ -2891,25 +2894,27 @@ async function src_main() { }); } - function setSelectMenuValues(from, to = lang) { + + function setSelectMenuValues(from) { if (!document.querySelector("#VOTSelectLanguages")) { return; } console.log(`Set translation from ${from} to ${to}`); document.querySelector("#VOTTranslateFromLang").value = from; - document.querySelector("#VOTTranslateToLang").value = to; + to = document.querySelector("#VOTTranslateToLang").value; } + // data - ytData or VideoData async function setDetectedLangauge(data, videolang) { switch (videolang) { case "en": data.detectedLanguage = videolang; - data.responseLanguage = lang; + data.responseLanguage = to; break; case "ru": data.detectedLanguage = videolang; - data.responseLanguage = lang; + data.responseLanguage = to; if (lang == "ru") data.responseLanguage = "en"; break; default: @@ -3216,7 +3221,8 @@ async function src_main() { if (window.location.hostname.includes("youtube.com")) { ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); utils_debug.log("VideoValidator videoData: ", videoData); - if (dontTranslateYourLang === 1 && ytData.detectedLanguage === lang) { + console.log("VOT TEST", to) + if (dontTranslateYourLang === 1 && ytData.detectedLanguage === lang || ytData.detectedLanguage === to) { firstPlay = false; throw translations[lang].VOTDisableFromYourLang; } diff --git a/src/index.js b/src/index.js index 30a74dd7..9f5b588e 100644 --- a/src/index.js +++ b/src/index.js @@ -35,6 +35,8 @@ let translateToLang = "ru"; // default language of audio response let ytData = ""; +let to = lang + async function main() { debug.log("Loading extension..."); debug.log(`Selected menu language: ${lang}`); @@ -294,6 +296,7 @@ async function main() { selectFromLang.appendChild(selectToLang); menuOptions.appendChild(selectFromLang); + menuOptions .querySelector("#VOTTranslateFromLang") .addEventListener("change", async (event) => { @@ -522,25 +525,27 @@ async function main() { }); } - function setSelectMenuValues(from, to = lang) { + + function setSelectMenuValues(from) { if (!document.querySelector("#VOTSelectLanguages")) { return; } console.log(`Set translation from ${from} to ${to}`); document.querySelector("#VOTTranslateFromLang").value = from; - document.querySelector("#VOTTranslateToLang").value = to; + to = document.querySelector("#VOTTranslateToLang").value; } + // data - ytData or VideoData async function setDetectedLangauge(data, videolang) { switch (videolang) { case "en": data.detectedLanguage = videolang; - data.responseLanguage = lang; + data.responseLanguage = to; break; case "ru": data.detectedLanguage = videolang; - data.responseLanguage = lang; + data.responseLanguage = to; if (lang == "ru") data.responseLanguage = "en"; break; default: @@ -847,7 +852,8 @@ async function main() { if (window.location.hostname.includes("youtube.com")) { ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); debug.log("VideoValidator videoData: ", videoData); - if (dontTranslateYourLang === 1 && ytData.detectedLanguage === lang) { + console.log("VOT TEST", to) + if (dontTranslateYourLang === 1 && ytData.detectedLanguage === lang || ytData.detectedLanguage === to) { firstPlay = false; throw translations[lang].VOTDisableFromYourLang; } From 3b82d41d7221bfb74c82bd245b770f00296c00c6 Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Wed, 26 Jul 2023 22:05:36 +0400 Subject: [PATCH 13/48] min fix --- dist/vot-cloudflare-min.user.js | 2 +- dist/vot-cloudflare.user.js | 6 +++--- dist/vot-min.user.js | 2 +- dist/vot.user.js | 6 +++--- src/index.js | 6 +++--- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/dist/vot-cloudflare-min.user.js b/dist/vot-cloudflare-min.user.js index e8aaf61e..1fb5b9b1 100644 --- a/dist/vot-cloudflare-min.user.js +++ b/dist/vot-cloudflare-min.user.js @@ -84,4 +84,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="",te=b;(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),$=await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}function U(e){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${te}`),document.querySelector("#VOTTranslateFromLang").value=e,te=document.querySelector("#VOTTranslateToLang").value)}async function Y(e,t){switch(t){case"en":e.detectedLanguage=t,e.responseLanguage=te;break;case"ru":e.detectedLanguage=t,e.responseLanguage=te,"ru"==b&&(e.responseLanguage="en");break;default:if(!Object.keys(v.tW).includes(t))return Y(e,"en");e.detectedLanguage=t}return U(e.detectedLanguage,e.responseLanguage),e}async function W(e,t){if("en"===t)e.responseLanguage=t,e.detectedLanguage="ru";else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)y.Z.log(`lipsync mode is ${e}`),o.pause(),"abort"===e&&(y.Z.log("lipsync mode is abort"),await ae()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const ne=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(ee=await Y(ee,ee.detectedLanguage),y.Z.log("VideoValidator videoData: ",$),console.log("VOT TEST",te),1===z&&ee.detectedLanguage===b||ee.detectedLanguage===te)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),ie(e,$.detectedLanguage,$.responseLanguage)};async function oe(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function ae(){await G(),await K()}function ie(t,a,i){!async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(`${v.g$[u]}${t}`,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ie(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(ae(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,oe))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const re=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?re(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&re(document.querySelector("#player"),["mousemove","mouseout"],l):re("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await ne(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await ne(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="",te=b;(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),$=await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,t=document.querySelector("#VOTTranslateToLang").value)}async function Y(e,t){switch(t){case"en":e.detectedLanguage=t,e.responseLanguage=te;break;case"ru":e.detectedLanguage=t,e.responseLanguage=te,"ru"==b&&(e.responseLanguage="en");break;default:if(!Object.keys(v.tW).includes(t))return Y(e,"en");e.detectedLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function W(e,t){if("en"===t)e.responseLanguage=t,e.detectedLanguage="ru";else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)y.Z.log(`lipsync mode is ${e}`),o.pause(),"abort"===e&&(y.Z.log("lipsync mode is abort"),await ae()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const ne=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(ee=await Y(ee,ee.detectedLanguage),y.Z.log("VideoValidator videoData: ",$),console.log("VOT TEST",te),1===z&&ee.detectedLanguage===b||ee.detectedLanguage===te)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),ie(e,$.detectedLanguage,$.responseLanguage)};async function oe(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function ae(){await G(),await K()}function ie(t,a,i){!async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(`${v.g$[u]}${t}`,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ie(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(ae(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,oe))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const re=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?re(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&re(document.querySelector("#player"),["mousemove","mouseout"],l):re("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await ne(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await ne(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot-cloudflare.user.js b/dist/vot-cloudflare.user.js index fc0430b5..c1ac9be2 100644 --- a/dist/vot-cloudflare.user.js +++ b/dist/vot-cloudflare.user.js @@ -2966,7 +2966,7 @@ async function src_main() { } - function setSelectMenuValues(from) { + async function setSelectMenuValues(from, to) { if (!document.querySelector("#VOTSelectLanguages")) { return; } @@ -2996,7 +2996,7 @@ async function src_main() { data.detectedLanguage = videolang; } - setSelectMenuValues(data.detectedLanguage, data.responseLanguage); + await setSelectMenuValues(data.detectedLanguage, data.responseLanguage); return data; } @@ -3020,7 +3020,7 @@ async function src_main() { data.responseLanguage = videolang; } - setSelectMenuValues(data.detectedLanguage, data.responseLanguage); + await setSelectMenuValues(data.detectedLanguage, data.responseLanguage); return data; } diff --git a/dist/vot-min.user.js b/dist/vot-min.user.js index e40bb04a..4f08375a 100644 --- a/dist/vot-min.user.js +++ b/dist/vot-min.user.js @@ -83,4 +83,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function k(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function x(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="",ne=V;(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),_=await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=x("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=x("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=x("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=x("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=x("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}function Y(e){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${ne}`),document.querySelector("#VOTTranslateFromLang").value=e,ne=document.querySelector("#VOTTranslateToLang").value)}async function G(e,t){switch(t){case"en":e.detectedLanguage=t,e.responseLanguage=ne;break;case"ru":e.detectedLanguage=t,e.responseLanguage=ne,"ru"==V&&(e.responseLanguage="en");break;default:if(!Object.keys(v).includes(t))return G(e,"en");e.detectedLanguage=t}return Y(e.detectedLanguage,e.responseLanguage),e}async function W(e,t){if("en"===t)e.responseLanguage=t,e.detectedLanguage="ru";else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",k("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}k("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)f.log(`lipsync mode is ${e}`),a.pause(),"abort"===e&&(f.log("lipsync mode is abort"),await oe()),"playing"===e&&(f.log("lipsync mode is playing"),a.play());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw k("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw k("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(te=await G(te,te.detectedLanguage),f.log("VideoValidator videoData: ",_),console.log("VOT TEST",ne),1===E&&te.detectedLanguage===V||te.detectedLanguage===ne)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),ie(e,_.detectedLanguage,_.responseLanguage)};async function ae(e){f.log(`video ${e.type}`),await J(e.type)}async function oe(){await Z(),await K()}function ie(t,o,i){!async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(`${y[d]}${t}`,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw k("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>ie(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(oe(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ae))))),k("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const re=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?re(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&re(document.querySelector("#player"),["mousemove","mouseout"],s):re("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){k("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){k("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function k(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function x(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="",ne=V;(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),_=await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=x("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=x("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=x("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=x("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=x("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,t=document.querySelector("#VOTTranslateToLang").value)}async function G(e,t){switch(t){case"en":e.detectedLanguage=t,e.responseLanguage=ne;break;case"ru":e.detectedLanguage=t,e.responseLanguage=ne,"ru"==V&&(e.responseLanguage="en");break;default:if(!Object.keys(v).includes(t))return G(e,"en");e.detectedLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function W(e,t){if("en"===t)e.responseLanguage=t,e.detectedLanguage="ru";else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",k("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}k("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)f.log(`lipsync mode is ${e}`),a.pause(),"abort"===e&&(f.log("lipsync mode is abort"),await oe()),"playing"===e&&(f.log("lipsync mode is playing"),a.play());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw k("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw k("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(te=await G(te,te.detectedLanguage),f.log("VideoValidator videoData: ",_),console.log("VOT TEST",ne),1===E&&te.detectedLanguage===V||te.detectedLanguage===ne)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),ie(e,_.detectedLanguage,_.responseLanguage)};async function ae(e){f.log(`video ${e.type}`),await J(e.type)}async function oe(){await Z(),await K()}function ie(t,o,i){!async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(`${y[d]}${t}`,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw k("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>ie(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(oe(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ae))))),k("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const re=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?re(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&re(document.querySelector("#player"),["mousemove","mouseout"],s):re("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){k("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){k("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot.user.js b/dist/vot.user.js index 37dbb625..fd20791a 100644 --- a/dist/vot.user.js +++ b/dist/vot.user.js @@ -2895,7 +2895,7 @@ async function src_main() { } - function setSelectMenuValues(from) { + async function setSelectMenuValues(from, to) { if (!document.querySelector("#VOTSelectLanguages")) { return; } @@ -2925,7 +2925,7 @@ async function src_main() { data.detectedLanguage = videolang; } - setSelectMenuValues(data.detectedLanguage, data.responseLanguage); + await setSelectMenuValues(data.detectedLanguage, data.responseLanguage); return data; } @@ -2949,7 +2949,7 @@ async function src_main() { data.responseLanguage = videolang; } - setSelectMenuValues(data.detectedLanguage, data.responseLanguage); + await setSelectMenuValues(data.detectedLanguage, data.responseLanguage); return data; } diff --git a/src/index.js b/src/index.js index 9f5b588e..06627e0b 100644 --- a/src/index.js +++ b/src/index.js @@ -526,7 +526,7 @@ async function main() { } - function setSelectMenuValues(from) { + async function setSelectMenuValues(from, to) { if (!document.querySelector("#VOTSelectLanguages")) { return; } @@ -556,7 +556,7 @@ async function main() { data.detectedLanguage = videolang; } - setSelectMenuValues(data.detectedLanguage, data.responseLanguage); + await setSelectMenuValues(data.detectedLanguage, data.responseLanguage); return data; } @@ -580,7 +580,7 @@ async function main() { data.responseLanguage = videolang; } - setSelectMenuValues(data.detectedLanguage, data.responseLanguage); + await setSelectMenuValues(data.detectedLanguage, data.responseLanguage); return data; } From a03aca2daf1063a7639d5bb8e512b5104111a13f Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Thu, 27 Jul 2023 02:45:11 +0400 Subject: [PATCH 14/48] fix lang change menu --- dist/vot-cloudflare-min.user.js | 2 +- dist/vot-cloudflare.user.js | 19 +++++++------------ dist/vot-min.user.js | 2 +- dist/vot.user.js | 19 +++++++------------ src/index.js | 19 +++++++------------ 5 files changed, 23 insertions(+), 38 deletions(-) diff --git a/dist/vot-cloudflare-min.user.js b/dist/vot-cloudflare-min.user.js index 1fb5b9b1..ec2ada49 100644 --- a/dist/vot-cloudflare-min.user.js +++ b/dist/vot-cloudflare-min.user.js @@ -84,4 +84,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="",te=b;(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),$=await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,t=document.querySelector("#VOTTranslateToLang").value)}async function Y(e,t){switch(t){case"en":e.detectedLanguage=t,e.responseLanguage=te;break;case"ru":e.detectedLanguage=t,e.responseLanguage=te,"ru"==b&&(e.responseLanguage="en");break;default:if(!Object.keys(v.tW).includes(t))return Y(e,"en");e.detectedLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function W(e,t){if("en"===t)e.responseLanguage=t,e.detectedLanguage="ru";else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)y.Z.log(`lipsync mode is ${e}`),o.pause(),"abort"===e&&(y.Z.log("lipsync mode is abort"),await ae()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const ne=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(ee=await Y(ee,ee.detectedLanguage),y.Z.log("VideoValidator videoData: ",$),console.log("VOT TEST",te),1===z&&ee.detectedLanguage===b||ee.detectedLanguage===te)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),ie(e,$.detectedLanguage,$.responseLanguage)};async function oe(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function ae(){await G(),await K()}function ie(t,a,i){!async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(`${v.g$[u]}${t}`,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ie(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(ae(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,oe))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const re=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?re(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&re(document.querySelector("#player"),["mousemove","mouseout"],l):re("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await ne(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await ne(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),$=await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,t=document.querySelector("#VOTTranslateToLang").value)}async function Y(e,t){switch(t){case"en":e.detectedLanguage=t,e.responseLanguage=b;break;case"ru":e.detectedLanguage=t,e.responseLanguage=b,"ru"==b&&(e.responseLanguage="en");break;default:if(!Object.keys(v.tW).includes(t))return Y(e,"en");e.detectedLanguage=t}return U(e.detectedLanguage,e.responseLanguage),e}async function W(e,t){if("en"===t)e.responseLanguage=t,e.detectedLanguage="ru";else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)y.Z.log(`lipsync mode is ${e}`),o.pause(),"abort"===e&&(y.Z.log("lipsync mode is abort"),await oe()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){ee=await Y(ee,ee.detectedLanguage);let e=document.querySelector("#VOTTranslateToLang").value;if(y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===b&&e===b)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}function ae(t,a,i){!async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(`${v.g$[u]}${t}`,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot-cloudflare.user.js b/dist/vot-cloudflare.user.js index c1ac9be2..a41f9a9e 100644 --- a/dist/vot-cloudflare.user.js +++ b/dist/vot-cloudflare.user.js @@ -2485,8 +2485,6 @@ let translateToLang = "ru"; // default language of audio response let ytData = ""; -let to = lang - async function src_main() { debug/* default */.Z.log("Loading extension..."); debug/* default */.Z.log(`Selected menu language: ${lang}`); @@ -2736,7 +2734,6 @@ async function src_main() { selectFromLang.appendChild(selectToLang); menuOptions.appendChild(selectFromLang); - menuOptions .querySelector("#VOTTranslateFromLang") .addEventListener("change", async (event) => { @@ -2965,8 +2962,7 @@ async function src_main() { }); } - - async function setSelectMenuValues(from, to) { + function setSelectMenuValues(from, to) { if (!document.querySelector("#VOTSelectLanguages")) { return; } @@ -2975,17 +2971,16 @@ async function src_main() { to = document.querySelector("#VOTTranslateToLang").value; } - // data - ytData or VideoData async function setDetectedLangauge(data, videolang) { switch (videolang) { case "en": data.detectedLanguage = videolang; - data.responseLanguage = to; + data.responseLanguage = lang; break; case "ru": data.detectedLanguage = videolang; - data.responseLanguage = to; + data.responseLanguage = lang; if (lang == "ru") data.responseLanguage = "en"; break; default: @@ -2996,7 +2991,7 @@ async function src_main() { data.detectedLanguage = videolang; } - await setSelectMenuValues(data.detectedLanguage, data.responseLanguage); + setSelectMenuValues(data.detectedLanguage, data.responseLanguage); return data; } @@ -3020,7 +3015,7 @@ async function src_main() { data.responseLanguage = videolang; } - await setSelectMenuValues(data.detectedLanguage, data.responseLanguage); + setSelectMenuValues(data.detectedLanguage, data.responseLanguage); return data; } @@ -3291,9 +3286,9 @@ async function src_main() { async function videoValidator() { if (window.location.hostname.includes("youtube.com")) { ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); + let to = document.querySelector("#VOTTranslateToLang").value; debug/* default */.Z.log("VideoValidator videoData: ", videoData); - console.log("VOT TEST", to) - if (dontTranslateYourLang === 1 && ytData.detectedLanguage === lang || ytData.detectedLanguage === to) { + if (dontTranslateYourLang === 1 && ytData.detectedLanguage === lang && to === lang) { firstPlay = false; throw constants/* translations */.Iz[lang].VOTDisableFromYourLang; } diff --git a/dist/vot-min.user.js b/dist/vot-min.user.js index 4f08375a..2a3a657b 100644 --- a/dist/vot-min.user.js +++ b/dist/vot-min.user.js @@ -83,4 +83,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function k(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function x(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="",ne=V;(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),_=await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=x("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=x("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=x("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=x("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=x("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,t=document.querySelector("#VOTTranslateToLang").value)}async function G(e,t){switch(t){case"en":e.detectedLanguage=t,e.responseLanguage=ne;break;case"ru":e.detectedLanguage=t,e.responseLanguage=ne,"ru"==V&&(e.responseLanguage="en");break;default:if(!Object.keys(v).includes(t))return G(e,"en");e.detectedLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function W(e,t){if("en"===t)e.responseLanguage=t,e.detectedLanguage="ru";else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",k("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}k("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)f.log(`lipsync mode is ${e}`),a.pause(),"abort"===e&&(f.log("lipsync mode is abort"),await oe()),"playing"===e&&(f.log("lipsync mode is playing"),a.play());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw k("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw k("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(te=await G(te,te.detectedLanguage),f.log("VideoValidator videoData: ",_),console.log("VOT TEST",ne),1===E&&te.detectedLanguage===V||te.detectedLanguage===ne)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),ie(e,_.detectedLanguage,_.responseLanguage)};async function ae(e){f.log(`video ${e.type}`),await J(e.type)}async function oe(){await Z(),await K()}function ie(t,o,i){!async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(`${y[d]}${t}`,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw k("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>ie(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(oe(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ae))))),k("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const re=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?re(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&re(document.querySelector("#player"),["mousemove","mouseout"],s):re("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){k("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){k("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function k(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function x(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),_=await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=x("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=x("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=x("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=x("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=x("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,t=document.querySelector("#VOTTranslateToLang").value)}async function G(e,t){switch(t){case"en":e.detectedLanguage=t,e.responseLanguage=V;break;case"ru":e.detectedLanguage=t,e.responseLanguage=V,"ru"==V&&(e.responseLanguage="en");break;default:if(!Object.keys(v).includes(t))return G(e,"en");e.detectedLanguage=t}return Y(e.detectedLanguage,e.responseLanguage),e}async function W(e,t){if("en"===t)e.responseLanguage=t,e.detectedLanguage="ru";else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",k("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}k("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)f.log(`lipsync mode is ${e}`),a.pause(),"abort"===e&&(f.log("lipsync mode is abort"),await ae()),"playing"===e&&(f.log("lipsync mode is playing"),a.play());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw k("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw k("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){te=await G(te,te.detectedLanguage);let e=document.querySelector("#VOTTranslateToLang").value;if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&e===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}function oe(t,o,i){!async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(`${y[d]}${t}`,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw k("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),k("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){k("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){k("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot.user.js b/dist/vot.user.js index fd20791a..d1d50ca4 100644 --- a/dist/vot.user.js +++ b/dist/vot.user.js @@ -2430,8 +2430,6 @@ let translateToLang = "ru"; // default language of audio response let ytData = ""; -let to = lang - async function src_main() { utils_debug.log("Loading extension..."); utils_debug.log(`Selected menu language: ${lang}`); @@ -2684,7 +2682,6 @@ async function src_main() { selectFromLang.appendChild(selectToLang); menuOptions.appendChild(selectFromLang); - menuOptions .querySelector("#VOTTranslateFromLang") .addEventListener("change", async (event) => { @@ -2894,8 +2891,7 @@ async function src_main() { }); } - - async function setSelectMenuValues(from, to) { + function setSelectMenuValues(from, to) { if (!document.querySelector("#VOTSelectLanguages")) { return; } @@ -2904,17 +2900,16 @@ async function src_main() { to = document.querySelector("#VOTTranslateToLang").value; } - // data - ytData or VideoData async function setDetectedLangauge(data, videolang) { switch (videolang) { case "en": data.detectedLanguage = videolang; - data.responseLanguage = to; + data.responseLanguage = lang; break; case "ru": data.detectedLanguage = videolang; - data.responseLanguage = to; + data.responseLanguage = lang; if (lang == "ru") data.responseLanguage = "en"; break; default: @@ -2925,7 +2920,7 @@ async function src_main() { data.detectedLanguage = videolang; } - await setSelectMenuValues(data.detectedLanguage, data.responseLanguage); + setSelectMenuValues(data.detectedLanguage, data.responseLanguage); return data; } @@ -2949,7 +2944,7 @@ async function src_main() { data.responseLanguage = videolang; } - await setSelectMenuValues(data.detectedLanguage, data.responseLanguage); + setSelectMenuValues(data.detectedLanguage, data.responseLanguage); return data; } @@ -3220,9 +3215,9 @@ async function src_main() { async function videoValidator() { if (window.location.hostname.includes("youtube.com")) { ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); + let to = document.querySelector("#VOTTranslateToLang").value; utils_debug.log("VideoValidator videoData: ", videoData); - console.log("VOT TEST", to) - if (dontTranslateYourLang === 1 && ytData.detectedLanguage === lang || ytData.detectedLanguage === to) { + if (dontTranslateYourLang === 1 && ytData.detectedLanguage === lang && to === lang) { firstPlay = false; throw translations[lang].VOTDisableFromYourLang; } diff --git a/src/index.js b/src/index.js index 06627e0b..5d9fd44c 100644 --- a/src/index.js +++ b/src/index.js @@ -35,8 +35,6 @@ let translateToLang = "ru"; // default language of audio response let ytData = ""; -let to = lang - async function main() { debug.log("Loading extension..."); debug.log(`Selected menu language: ${lang}`); @@ -296,7 +294,6 @@ async function main() { selectFromLang.appendChild(selectToLang); menuOptions.appendChild(selectFromLang); - menuOptions .querySelector("#VOTTranslateFromLang") .addEventListener("change", async (event) => { @@ -525,8 +522,7 @@ async function main() { }); } - - async function setSelectMenuValues(from, to) { + function setSelectMenuValues(from, to) { if (!document.querySelector("#VOTSelectLanguages")) { return; } @@ -535,17 +531,16 @@ async function main() { to = document.querySelector("#VOTTranslateToLang").value; } - // data - ytData or VideoData async function setDetectedLangauge(data, videolang) { switch (videolang) { case "en": data.detectedLanguage = videolang; - data.responseLanguage = to; + data.responseLanguage = lang; break; case "ru": data.detectedLanguage = videolang; - data.responseLanguage = to; + data.responseLanguage = lang; if (lang == "ru") data.responseLanguage = "en"; break; default: @@ -556,7 +551,7 @@ async function main() { data.detectedLanguage = videolang; } - await setSelectMenuValues(data.detectedLanguage, data.responseLanguage); + setSelectMenuValues(data.detectedLanguage, data.responseLanguage); return data; } @@ -580,7 +575,7 @@ async function main() { data.responseLanguage = videolang; } - await setSelectMenuValues(data.detectedLanguage, data.responseLanguage); + setSelectMenuValues(data.detectedLanguage, data.responseLanguage); return data; } @@ -851,9 +846,9 @@ async function main() { async function videoValidator() { if (window.location.hostname.includes("youtube.com")) { ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); + let to = document.querySelector("#VOTTranslateToLang").value; debug.log("VideoValidator videoData: ", videoData); - console.log("VOT TEST", to) - if (dontTranslateYourLang === 1 && ytData.detectedLanguage === lang || ytData.detectedLanguage === to) { + if (dontTranslateYourLang === 1 && ytData.detectedLanguage === lang && to === lang) { firstPlay = false; throw translations[lang].VOTDisableFromYourLang; } From 94ecdd78ff4589ee37d1c93deddc6fc60faf7a84 Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Thu, 27 Jul 2023 06:08:25 +0400 Subject: [PATCH 15/48] Fixed menu change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Теперь МОЖНО спокойно изменять язык, после смены видео язык вновь откатится на ваш язык браузера --- dist/vot-cloudflare-min.user.js | 2 +- dist/vot-cloudflare.user.js | 41 ++++++++++++++++++--------------- dist/vot-min.user.js | 2 +- dist/vot.user.js | 41 ++++++++++++++++++--------------- src/index.js | 37 ++++++++++++++--------------- src/utils/getYTVideoData.js | 4 ++++ 6 files changed, 71 insertions(+), 56 deletions(-) diff --git a/dist/vot-cloudflare-min.user.js b/dist/vot-cloudflare-min.user.js index ec2ada49..ddbeb10d 100644 --- a/dist/vot-cloudflare-min.user.js +++ b/dist/vot-cloudflare-min.user.js @@ -84,4 +84,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),$=await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,t=document.querySelector("#VOTTranslateToLang").value)}async function Y(e,t){switch(t){case"en":e.detectedLanguage=t,e.responseLanguage=b;break;case"ru":e.detectedLanguage=t,e.responseLanguage=b,"ru"==b&&(e.responseLanguage="en");break;default:if(!Object.keys(v.tW).includes(t))return Y(e,"en");e.detectedLanguage=t}return U(e.detectedLanguage,e.responseLanguage),e}async function W(e,t){if("en"===t)e.responseLanguage=t,e.detectedLanguage="ru";else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)y.Z.log(`lipsync mode is ${e}`),o.pause(),"abort"===e&&(y.Z.log("lipsync mode is abort"),await oe()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){ee=await Y(ee,ee.detectedLanguage);let e=document.querySelector("#VOTTranslateToLang").value;if(y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===b&&e===b)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}function ae(t,a,i){!async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(`${v.g$[u]}${t}`,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),$=await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){switch(t){case"en":e.detectedLanguage=t,e.responseLanguage=b;break;case"ru":e.detectedLanguage=t,e.responseLanguage=b,"ru"==b&&(e.responseLanguage="en");break;default:if(!Object.keys(v.tW).includes(t))return Y(e,"en");e.detectedLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)y.Z.log(`lipsync mode is ${e}`),o.pause(),"abort"===e&&(y.Z.log("lipsync mode is abort"),await oe()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}function ae(t,a,i){!async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(`${v.g$[u]}${t}`,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot-cloudflare.user.js b/dist/vot-cloudflare.user.js index a41f9a9e..8192f01f 100644 --- a/dist/vot-cloudflare.user.js +++ b/dist/vot-cloudflare.user.js @@ -1560,6 +1560,9 @@ var update = injectStylesIntoStyleTag_default()(main/* default */.Z, options); ;// CONCATENATED MODULE: ./src/utils/getYTVideoData.js async function detect(cleanText) { + if (!cleanText) { + return; + } const response = await fetch("https://rust-server-531j.onrender.com/detect", { method: "POST", body: cleanText, @@ -1567,6 +1570,7 @@ async function detect(cleanText) { return await response.text(); } + // Get the language code from the response or the text async function getLanguage(player, response, title, description, author) { if (!window.location.hostname.includes("m.youtube.com")) { @@ -2962,15 +2966,17 @@ async function src_main() { }); } - function setSelectMenuValues(from, to) { - if (!document.querySelector("#VOTSelectLanguages")) { + async function setSelectMenuValues(from, to) { + const selectLanguages = document.querySelector("#VOTSelectLanguages"); + if (!selectLanguages) { return; } console.log(`Set translation from ${from} to ${to}`); document.querySelector("#VOTTranslateFromLang").value = from; - to = document.querySelector("#VOTTranslateToLang").value; + document.querySelector("#VOTTranslateToLang").value = to; + ytData.responseLanguage = to } - + // data - ytData or VideoData async function setDetectedLangauge(data, videolang) { switch (videolang) { @@ -2987,38 +2993,39 @@ async function src_main() { if (!Object.keys(constants/* availableLangs */.tW).includes(videolang)) { return setDetectedLangauge(data, "en"); } - + data.detectedLanguage = videolang; } - - setSelectMenuValues(data.detectedLanguage, data.responseLanguage); - + + await setSelectMenuValues(data.detectedLanguage, data.responseLanguage); + return data; } - + // data - ytData or VideoData async function setResponseLangauge(data, videolang) { switch (videolang) { case "en": data.responseLanguage = videolang; - data.detectedLanguage = "ru"; + if (lang == "ru") data.detectedLanguage = "ru"; break; default: if (!Object.keys(constants/* availableLangs */.tW).includes(videolang)) { return setResponseLangauge(data, "ru"); } - + if (data.detectedLanguage && data.responseLanguage === lang) { data.detectedLanguage = "en"; } - + data.responseLanguage = videolang; } - - setSelectMenuValues(data.detectedLanguage, data.responseLanguage); - + + await setSelectMenuValues(data.detectedLanguage, data.responseLanguage); + return data; } + async function stopTraslate() { // Default actions on stop translate @@ -3285,10 +3292,8 @@ async function src_main() { async function videoValidator() { if (window.location.hostname.includes("youtube.com")) { - ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); - let to = document.querySelector("#VOTTranslateToLang").value; debug/* default */.Z.log("VideoValidator videoData: ", videoData); - if (dontTranslateYourLang === 1 && ytData.detectedLanguage === lang && to === lang) { + if (dontTranslateYourLang === 1 && ytData.detectedLanguage === lang && ytData.responseLanguage === lang) { firstPlay = false; throw constants/* translations */.Iz[lang].VOTDisableFromYourLang; } diff --git a/dist/vot-min.user.js b/dist/vot-min.user.js index 2a3a657b..a8a0d911 100644 --- a/dist/vot-min.user.js +++ b/dist/vot-min.user.js @@ -83,4 +83,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function k(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function x(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),_=await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=x("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=x("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=x("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=x("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=x("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,t=document.querySelector("#VOTTranslateToLang").value)}async function G(e,t){switch(t){case"en":e.detectedLanguage=t,e.responseLanguage=V;break;case"ru":e.detectedLanguage=t,e.responseLanguage=V,"ru"==V&&(e.responseLanguage="en");break;default:if(!Object.keys(v).includes(t))return G(e,"en");e.detectedLanguage=t}return Y(e.detectedLanguage,e.responseLanguage),e}async function W(e,t){if("en"===t)e.responseLanguage=t,e.detectedLanguage="ru";else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",k("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}k("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)f.log(`lipsync mode is ${e}`),a.pause(),"abort"===e&&(f.log("lipsync mode is abort"),await ae()),"playing"===e&&(f.log("lipsync mode is playing"),a.play());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw k("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw k("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){te=await G(te,te.detectedLanguage);let e=document.querySelector("#VOTTranslateToLang").value;if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&e===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}function oe(t,o,i){!async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(`${y[d]}${t}`,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw k("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),k("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){k("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){k("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function k(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function x(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),_=await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=x("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=x("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=x("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=x("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=x("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){switch(t){case"en":e.detectedLanguage=t,e.responseLanguage=V;break;case"ru":e.detectedLanguage=t,e.responseLanguage=V,"ru"==V&&(e.responseLanguage="en");break;default:if(!Object.keys(v).includes(t))return G(e,"en");e.detectedLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",k("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}k("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)f.log(`lipsync mode is ${e}`),a.pause(),"abort"===e&&(f.log("lipsync mode is abort"),await ae()),"playing"===e&&(f.log("lipsync mode is playing"),a.play());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw k("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw k("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}function oe(t,o,i){!async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(`${y[d]}${t}`,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw k("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),k("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){k("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){k("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot.user.js b/dist/vot.user.js index d1d50ca4..441ba4c5 100644 --- a/dist/vot.user.js +++ b/dist/vot.user.js @@ -1074,6 +1074,9 @@ var update = injectStylesIntoStyleTag_default()(main/* default */.Z, options); ;// CONCATENATED MODULE: ./src/utils/getYTVideoData.js async function detect(cleanText) { + if (!cleanText) { + return; + } const response = await fetch("https://rust-server-531j.onrender.com/detect", { method: "POST", body: cleanText, @@ -1081,6 +1084,7 @@ async function detect(cleanText) { return await response.text(); } + // Get the language code from the response or the text async function getLanguage(player, response, title, description, author) { if (!window.location.hostname.includes("m.youtube.com")) { @@ -2891,15 +2895,17 @@ async function src_main() { }); } - function setSelectMenuValues(from, to) { - if (!document.querySelector("#VOTSelectLanguages")) { + async function setSelectMenuValues(from, to) { + const selectLanguages = document.querySelector("#VOTSelectLanguages"); + if (!selectLanguages) { return; } console.log(`Set translation from ${from} to ${to}`); document.querySelector("#VOTTranslateFromLang").value = from; - to = document.querySelector("#VOTTranslateToLang").value; + document.querySelector("#VOTTranslateToLang").value = to; + ytData.responseLanguage = to } - + // data - ytData or VideoData async function setDetectedLangauge(data, videolang) { switch (videolang) { @@ -2916,38 +2922,39 @@ async function src_main() { if (!Object.keys(availableLangs).includes(videolang)) { return setDetectedLangauge(data, "en"); } - + data.detectedLanguage = videolang; } - - setSelectMenuValues(data.detectedLanguage, data.responseLanguage); - + + await setSelectMenuValues(data.detectedLanguage, data.responseLanguage); + return data; } - + // data - ytData or VideoData async function setResponseLangauge(data, videolang) { switch (videolang) { case "en": data.responseLanguage = videolang; - data.detectedLanguage = "ru"; + if (lang == "ru") data.detectedLanguage = "ru"; break; default: if (!Object.keys(availableLangs).includes(videolang)) { return setResponseLangauge(data, "ru"); } - + if (data.detectedLanguage && data.responseLanguage === lang) { data.detectedLanguage = "en"; } - + data.responseLanguage = videolang; } - - setSelectMenuValues(data.detectedLanguage, data.responseLanguage); - + + await setSelectMenuValues(data.detectedLanguage, data.responseLanguage); + return data; } + async function stopTraslate() { // Default actions on stop translate @@ -3214,10 +3221,8 @@ async function src_main() { async function videoValidator() { if (window.location.hostname.includes("youtube.com")) { - ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); - let to = document.querySelector("#VOTTranslateToLang").value; utils_debug.log("VideoValidator videoData: ", videoData); - if (dontTranslateYourLang === 1 && ytData.detectedLanguage === lang && to === lang) { + if (dontTranslateYourLang === 1 && ytData.detectedLanguage === lang && ytData.responseLanguage === lang) { firstPlay = false; throw translations[lang].VOTDisableFromYourLang; } diff --git a/src/index.js b/src/index.js index 5d9fd44c..209abf47 100644 --- a/src/index.js +++ b/src/index.js @@ -522,15 +522,17 @@ async function main() { }); } - function setSelectMenuValues(from, to) { - if (!document.querySelector("#VOTSelectLanguages")) { + async function setSelectMenuValues(from, to) { + const selectLanguages = document.querySelector("#VOTSelectLanguages"); + if (!selectLanguages) { return; } console.log(`Set translation from ${from} to ${to}`); document.querySelector("#VOTTranslateFromLang").value = from; - to = document.querySelector("#VOTTranslateToLang").value; + document.querySelector("#VOTTranslateToLang").value = to; + ytData.responseLanguage = to } - + // data - ytData or VideoData async function setDetectedLangauge(data, videolang) { switch (videolang) { @@ -547,38 +549,39 @@ async function main() { if (!Object.keys(availableLangs).includes(videolang)) { return setDetectedLangauge(data, "en"); } - + data.detectedLanguage = videolang; } - - setSelectMenuValues(data.detectedLanguage, data.responseLanguage); - + + await setSelectMenuValues(data.detectedLanguage, data.responseLanguage); + return data; } - + // data - ytData or VideoData async function setResponseLangauge(data, videolang) { switch (videolang) { case "en": data.responseLanguage = videolang; - data.detectedLanguage = "ru"; + if (lang == "ru") data.detectedLanguage = "ru"; break; default: if (!Object.keys(availableLangs).includes(videolang)) { return setResponseLangauge(data, "ru"); } - + if (data.detectedLanguage && data.responseLanguage === lang) { data.detectedLanguage = "en"; } - + data.responseLanguage = videolang; } - - setSelectMenuValues(data.detectedLanguage, data.responseLanguage); - + + await setSelectMenuValues(data.detectedLanguage, data.responseLanguage); + return data; } + async function stopTraslate() { // Default actions on stop translate @@ -845,10 +848,8 @@ async function main() { async function videoValidator() { if (window.location.hostname.includes("youtube.com")) { - ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); - let to = document.querySelector("#VOTTranslateToLang").value; debug.log("VideoValidator videoData: ", videoData); - if (dontTranslateYourLang === 1 && ytData.detectedLanguage === lang && to === lang) { + if (dontTranslateYourLang === 1 && ytData.detectedLanguage === lang && ytData.responseLanguage === lang) { firstPlay = false; throw translations[lang].VOTDisableFromYourLang; } diff --git a/src/utils/getYTVideoData.js b/src/utils/getYTVideoData.js index e41d4009..7478d6de 100644 --- a/src/utils/getYTVideoData.js +++ b/src/utils/getYTVideoData.js @@ -1,4 +1,7 @@ async function detect(cleanText) { + if (!cleanText) { + return; + } const response = await fetch("https://rust-server-531j.onrender.com/detect", { method: "POST", body: cleanText, @@ -6,6 +9,7 @@ async function detect(cleanText) { return await response.text(); } + // Get the language code from the response or the text async function getLanguage(player, response, title, description, author) { if (!window.location.hostname.includes("m.youtube.com")) { From 0d0da6fc8a0251fe8079062fc48f084d82b91eed Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Thu, 27 Jul 2023 06:27:19 +0400 Subject: [PATCH 16/48] Add files via upload --- dist/vot-cloudflare-min.user.js | 2 +- dist/vot-cloudflare.user.js | 11 ++--------- dist/vot-min.user.js | 2 +- dist/vot.user.js | 11 ++--------- src/index.js | 11 ++--------- 5 files changed, 8 insertions(+), 29 deletions(-) diff --git a/dist/vot-cloudflare-min.user.js b/dist/vot-cloudflare-min.user.js index ddbeb10d..b3d8e83d 100644 --- a/dist/vot-cloudflare-min.user.js +++ b/dist/vot-cloudflare-min.user.js @@ -84,4 +84,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),$=await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){switch(t){case"en":e.detectedLanguage=t,e.responseLanguage=b;break;case"ru":e.detectedLanguage=t,e.responseLanguage=b,"ru"==b&&(e.responseLanguage="en");break;default:if(!Object.keys(v.tW).includes(t))return Y(e,"en");e.detectedLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)y.Z.log(`lipsync mode is ${e}`),o.pause(),"abort"===e&&(y.Z.log("lipsync mode is abort"),await oe()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}function ae(t,a,i){!async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(`${v.g$[u]}${t}`,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),$=await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(e.detectedLanguage=t,await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)y.Z.log(`lipsync mode is ${e}`),o.pause(),"abort"===e&&(y.Z.log("lipsync mode is abort"),await oe()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}function ae(t,a,i){!async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(`${v.g$[u]}${t}`,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot-cloudflare.user.js b/dist/vot-cloudflare.user.js index 8192f01f..a8a890f1 100644 --- a/dist/vot-cloudflare.user.js +++ b/dist/vot-cloudflare.user.js @@ -2979,16 +2979,9 @@ async function src_main() { // data - ytData or VideoData async function setDetectedLangauge(data, videolang) { + data.detectedLanguage = videolang; + data.responseLanguage = lang; switch (videolang) { - case "en": - data.detectedLanguage = videolang; - data.responseLanguage = lang; - break; - case "ru": - data.detectedLanguage = videolang; - data.responseLanguage = lang; - if (lang == "ru") data.responseLanguage = "en"; - break; default: if (!Object.keys(constants/* availableLangs */.tW).includes(videolang)) { return setDetectedLangauge(data, "en"); diff --git a/dist/vot-min.user.js b/dist/vot-min.user.js index a8a0d911..01f089a3 100644 --- a/dist/vot-min.user.js +++ b/dist/vot-min.user.js @@ -83,4 +83,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function k(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function x(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),_=await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=x("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=x("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=x("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=x("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=x("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){switch(t){case"en":e.detectedLanguage=t,e.responseLanguage=V;break;case"ru":e.detectedLanguage=t,e.responseLanguage=V,"ru"==V&&(e.responseLanguage="en");break;default:if(!Object.keys(v).includes(t))return G(e,"en");e.detectedLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",k("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}k("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)f.log(`lipsync mode is ${e}`),a.pause(),"abort"===e&&(f.log("lipsync mode is abort"),await ae()),"playing"===e&&(f.log("lipsync mode is playing"),a.play());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw k("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw k("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}function oe(t,o,i){!async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(`${y[d]}${t}`,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw k("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),k("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){k("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){k("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),_=await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(e.detectedLanguage=t,await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)f.log(`lipsync mode is ${e}`),a.pause(),"abort"===e&&(f.log("lipsync mode is abort"),await ae()),"playing"===e&&(f.log("lipsync mode is playing"),a.play());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}function oe(t,o,i){!async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(`${y[d]}${t}`,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot.user.js b/dist/vot.user.js index 441ba4c5..602282f1 100644 --- a/dist/vot.user.js +++ b/dist/vot.user.js @@ -2908,16 +2908,9 @@ async function src_main() { // data - ytData or VideoData async function setDetectedLangauge(data, videolang) { + data.detectedLanguage = videolang; + data.responseLanguage = lang; switch (videolang) { - case "en": - data.detectedLanguage = videolang; - data.responseLanguage = lang; - break; - case "ru": - data.detectedLanguage = videolang; - data.responseLanguage = lang; - if (lang == "ru") data.responseLanguage = "en"; - break; default: if (!Object.keys(availableLangs).includes(videolang)) { return setDetectedLangauge(data, "en"); diff --git a/src/index.js b/src/index.js index 209abf47..e15aeea9 100644 --- a/src/index.js +++ b/src/index.js @@ -535,16 +535,9 @@ async function main() { // data - ytData or VideoData async function setDetectedLangauge(data, videolang) { + data.detectedLanguage = videolang; + data.responseLanguage = lang; switch (videolang) { - case "en": - data.detectedLanguage = videolang; - data.responseLanguage = lang; - break; - case "ru": - data.detectedLanguage = videolang; - data.responseLanguage = lang; - if (lang == "ru") data.responseLanguage = "en"; - break; default: if (!Object.keys(availableLangs).includes(videolang)) { return setDetectedLangauge(data, "en"); From fc293789e7ca641d182fc4609d1fbd141adf68ce Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Thu, 27 Jul 2023 06:39:15 +0400 Subject: [PATCH 17/48] Add files via upload --- dist/vot-cloudflare-min.user.js | 2 +- dist/vot-cloudflare.user.js | 15 ++++++++------- dist/vot-min.user.js | 2 +- dist/vot.user.js | 15 ++++++++------- src/index.js | 15 ++++++++------- 5 files changed, 26 insertions(+), 23 deletions(-) diff --git a/dist/vot-cloudflare-min.user.js b/dist/vot-cloudflare-min.user.js index b3d8e83d..4fcb5bb3 100644 --- a/dist/vot-cloudflare-min.user.js +++ b/dist/vot-cloudflare-min.user.js @@ -84,4 +84,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),$=await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(e.detectedLanguage=t,await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)y.Z.log(`lipsync mode is ${e}`),o.pause(),"abort"===e&&(y.Z.log("lipsync mode is abort"),await oe()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}function ae(t,a,i){!async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(`${v.g$[u]}${t}`,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const $={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},Z=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,$=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let Z=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",Z);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:Z.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:Z.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),Z=await W(Z,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(e.detectedLanguage=t,await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)y.Z.log(`lipsync mode is ${e}`),o.pause(),"abort"===e&&(y.Z.log("lipsync mode is abort"),await oe()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(await Y(Z,ee.detectedLanguage),y.Z.log("VideoValidator videoData: ",Z),1===z&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw $=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if(Z.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,Z.detectedLanguage,Z.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}function ae(t,a,i){!async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(`${v.g$[u]}${t}`,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),$=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!$||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),$=!1}catch(e){O("error",String(e).substring(4,e.length)),$=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),$.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(Z);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot-cloudflare.user.js b/dist/vot-cloudflare.user.js index a8a890f1..b5926a50 100644 --- a/dist/vot-cloudflare.user.js +++ b/dist/vot-cloudflare.user.js @@ -2738,12 +2738,12 @@ async function src_main() { selectFromLang.appendChild(selectToLang); menuOptions.appendChild(selectFromLang); - menuOptions - .querySelector("#VOTTranslateFromLang") - .addEventListener("change", async (event) => { - debug/* default */.Z.log("[onchange] select from language", event.target.value); - videoData = await setDetectedLangauge(videoData, event.target.value); - }); + // menuOptions + // .querySelector("#VOTTranslateFromLang") + // .addEventListener("change", async (event) => { + // debug.log("[onchange] select from language", event.target.value); + // await setDetectedLangauge(videoData, event.target.value); + // }); menuOptions .querySelector("#VOTTranslateToLang") @@ -3285,6 +3285,7 @@ async function src_main() { async function videoValidator() { if (window.location.hostname.includes("youtube.com")) { + await setDetectedLangauge(videoData, ytData.detectedLanguage); debug/* default */.Z.log("VideoValidator videoData: ", videoData); if (dontTranslateYourLang === 1 && ytData.detectedLanguage === lang && ytData.responseLanguage === lang) { firstPlay = false; @@ -3309,7 +3310,7 @@ async function src_main() { debug/* default */.Z.log("Run videoValidator"); await videoValidator(); debug/* default */.Z.log("Run translateFunc"); - translateFunc( + await translateFunc( VIDEO_ID, videoData.detectedLanguage, videoData.responseLanguage diff --git a/dist/vot-min.user.js b/dist/vot-min.user.js index 01f089a3..9eec9d86 100644 --- a/dist/vot-min.user.js +++ b/dist/vot-min.user.js @@ -83,4 +83,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),_=await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(e.detectedLanguage=t,await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)f.log(`lipsync mode is ${e}`),a.pause(),"abort"===e&&(f.log("lipsync mode is abort"),await ae()),"playing"===e&&(f.log("lipsync mode is playing"),a.play());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}function oe(t,o,i){!async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(`${y[d]}${t}`,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(e.detectedLanguage=t,await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)f.log(`lipsync mode is ${e}`),a.pause(),"abort"===e&&(f.log("lipsync mode is abort"),await ae()),"playing"===e&&(f.log("lipsync mode is playing"),a.play());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(await G(_,te.detectedLanguage),f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}function oe(t,o,i){!async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(`${y[d]}${t}`,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot.user.js b/dist/vot.user.js index 602282f1..1789f8b3 100644 --- a/dist/vot.user.js +++ b/dist/vot.user.js @@ -2686,12 +2686,12 @@ async function src_main() { selectFromLang.appendChild(selectToLang); menuOptions.appendChild(selectFromLang); - menuOptions - .querySelector("#VOTTranslateFromLang") - .addEventListener("change", async (event) => { - utils_debug.log("[onchange] select from language", event.target.value); - videoData = await setDetectedLangauge(videoData, event.target.value); - }); + // menuOptions + // .querySelector("#VOTTranslateFromLang") + // .addEventListener("change", async (event) => { + // debug.log("[onchange] select from language", event.target.value); + // await setDetectedLangauge(videoData, event.target.value); + // }); menuOptions .querySelector("#VOTTranslateToLang") @@ -3214,6 +3214,7 @@ async function src_main() { async function videoValidator() { if (window.location.hostname.includes("youtube.com")) { + await setDetectedLangauge(videoData, ytData.detectedLanguage); utils_debug.log("VideoValidator videoData: ", videoData); if (dontTranslateYourLang === 1 && ytData.detectedLanguage === lang && ytData.responseLanguage === lang) { firstPlay = false; @@ -3238,7 +3239,7 @@ async function src_main() { utils_debug.log("Run videoValidator"); await videoValidator(); utils_debug.log("Run translateFunc"); - translateFunc( + await translateFunc( VIDEO_ID, videoData.detectedLanguage, videoData.responseLanguage diff --git a/src/index.js b/src/index.js index e15aeea9..440df317 100644 --- a/src/index.js +++ b/src/index.js @@ -294,12 +294,12 @@ async function main() { selectFromLang.appendChild(selectToLang); menuOptions.appendChild(selectFromLang); - menuOptions - .querySelector("#VOTTranslateFromLang") - .addEventListener("change", async (event) => { - debug.log("[onchange] select from language", event.target.value); - videoData = await setDetectedLangauge(videoData, event.target.value); - }); + // menuOptions + // .querySelector("#VOTTranslateFromLang") + // .addEventListener("change", async (event) => { + // debug.log("[onchange] select from language", event.target.value); + // await setDetectedLangauge(videoData, event.target.value); + // }); menuOptions .querySelector("#VOTTranslateToLang") @@ -841,6 +841,7 @@ async function main() { async function videoValidator() { if (window.location.hostname.includes("youtube.com")) { + await setDetectedLangauge(videoData, ytData.detectedLanguage); debug.log("VideoValidator videoData: ", videoData); if (dontTranslateYourLang === 1 && ytData.detectedLanguage === lang && ytData.responseLanguage === lang) { firstPlay = false; @@ -865,7 +866,7 @@ async function main() { debug.log("Run videoValidator"); await videoValidator(); debug.log("Run translateFunc"); - translateFunc( + await translateFunc( VIDEO_ID, videoData.detectedLanguage, videoData.responseLanguage From c1b8f6f1bc8e605639c97a352eda55d307eae026 Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Thu, 27 Jul 2023 06:52:19 +0400 Subject: [PATCH 18/48] Add files via upload --- dist/vot-cloudflare-min.user.js | 2 +- dist/vot-cloudflare.user.js | 17 +++++++++-------- dist/vot-min.user.js | 2 +- dist/vot.user.js | 17 +++++++++-------- src/index.js | 17 +++++++++-------- 5 files changed, 29 insertions(+), 26 deletions(-) diff --git a/dist/vot-cloudflare-min.user.js b/dist/vot-cloudflare-min.user.js index 4fcb5bb3..eb07a621 100644 --- a/dist/vot-cloudflare-min.user.js +++ b/dist/vot-cloudflare-min.user.js @@ -84,4 +84,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const $={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},Z=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,$=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let Z=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",Z);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:Z.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:Z.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),Z=await W(Z,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(e.detectedLanguage=t,await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)y.Z.log(`lipsync mode is ${e}`),o.pause(),"abort"===e&&(y.Z.log("lipsync mode is abort"),await oe()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(await Y(Z,ee.detectedLanguage),y.Z.log("VideoValidator videoData: ",Z),1===z&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw $=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if(Z.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,Z.detectedLanguage,Z.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}function ae(t,a,i){!async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(`${v.g$[u]}${t}`,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),$=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!$||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),$=!1}catch(e){O("error",String(e).substring(4,e.length)),$=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),$.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(Z);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await async function(){const e={};if(e.duration=p?.duration||0,e.videoId=I(u),e.videoId)return e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(e.detectedLanguage=t,await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)y.Z.log(`lipsync mode is ${e}`),o.pause(),"abort"===e&&(y.Z.log("lipsync mode is abort"),await oe()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}function ae(t,a,i){!async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(`${v.g$[u]}${t}`,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot-cloudflare.user.js b/dist/vot-cloudflare.user.js index b5926a50..757e8dbd 100644 --- a/dist/vot-cloudflare.user.js +++ b/dist/vot-cloudflare.user.js @@ -2738,12 +2738,12 @@ async function src_main() { selectFromLang.appendChild(selectToLang); menuOptions.appendChild(selectFromLang); - // menuOptions - // .querySelector("#VOTTranslateFromLang") - // .addEventListener("change", async (event) => { - // debug.log("[onchange] select from language", event.target.value); - // await setDetectedLangauge(videoData, event.target.value); - // }); + menuOptions + .querySelector("#VOTTranslateFromLang") + .addEventListener("change", async (event) => { + debug/* default */.Z.log("[onchange] select from language", event.target.value); + await setDetectedLangauge(videoData, event.target.value); + }); menuOptions .querySelector("#VOTTranslateToLang") @@ -3065,7 +3065,9 @@ async function src_main() { videoData.duration = video?.duration || 0; - videoData.videoId = getVideoId(siteHostname); + videoData.videoId = getVideoId(siteHostname) ; + + if (!videoData.videoId) return "Айди видео нет"; videoData.detectedLanguage = translateFromLang; @@ -3285,7 +3287,6 @@ async function src_main() { async function videoValidator() { if (window.location.hostname.includes("youtube.com")) { - await setDetectedLangauge(videoData, ytData.detectedLanguage); debug/* default */.Z.log("VideoValidator videoData: ", videoData); if (dontTranslateYourLang === 1 && ytData.detectedLanguage === lang && ytData.responseLanguage === lang) { firstPlay = false; diff --git a/dist/vot-min.user.js b/dist/vot-min.user.js index 9eec9d86..d4c6480b 100644 --- a/dist/vot-min.user.js +++ b/dist/vot-min.user.js @@ -83,4 +83,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(e.detectedLanguage=t,await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)f.log(`lipsync mode is ${e}`),a.pause(),"abort"===e&&(f.log("lipsync mode is abort"),await ae()),"playing"===e&&(f.log("lipsync mode is playing"),a.play());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(await G(_,te.detectedLanguage),f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}function oe(t,o,i){!async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(`${y[d]}${t}`,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};if(e.duration=c?.duration||0,e.videoId=A(d),e.videoId)return e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(e.detectedLanguage=t,await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)f.log(`lipsync mode is ${e}`),a.pause(),"abort"===e&&(f.log("lipsync mode is abort"),await ae()),"playing"===e&&(f.log("lipsync mode is playing"),a.play());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}function oe(t,o,i){!async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(`${y[d]}${t}`,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot.user.js b/dist/vot.user.js index 1789f8b3..6bfb6595 100644 --- a/dist/vot.user.js +++ b/dist/vot.user.js @@ -2686,12 +2686,12 @@ async function src_main() { selectFromLang.appendChild(selectToLang); menuOptions.appendChild(selectFromLang); - // menuOptions - // .querySelector("#VOTTranslateFromLang") - // .addEventListener("change", async (event) => { - // debug.log("[onchange] select from language", event.target.value); - // await setDetectedLangauge(videoData, event.target.value); - // }); + menuOptions + .querySelector("#VOTTranslateFromLang") + .addEventListener("change", async (event) => { + utils_debug.log("[onchange] select from language", event.target.value); + await setDetectedLangauge(videoData, event.target.value); + }); menuOptions .querySelector("#VOTTranslateToLang") @@ -2994,7 +2994,9 @@ async function src_main() { videoData.duration = video?.duration || 0; - videoData.videoId = getVideoId(siteHostname); + videoData.videoId = getVideoId(siteHostname) ; + + if (!videoData.videoId) return "Айди видео нет"; videoData.detectedLanguage = translateFromLang; @@ -3214,7 +3216,6 @@ async function src_main() { async function videoValidator() { if (window.location.hostname.includes("youtube.com")) { - await setDetectedLangauge(videoData, ytData.detectedLanguage); utils_debug.log("VideoValidator videoData: ", videoData); if (dontTranslateYourLang === 1 && ytData.detectedLanguage === lang && ytData.responseLanguage === lang) { firstPlay = false; diff --git a/src/index.js b/src/index.js index 440df317..43b67095 100644 --- a/src/index.js +++ b/src/index.js @@ -294,12 +294,12 @@ async function main() { selectFromLang.appendChild(selectToLang); menuOptions.appendChild(selectFromLang); - // menuOptions - // .querySelector("#VOTTranslateFromLang") - // .addEventListener("change", async (event) => { - // debug.log("[onchange] select from language", event.target.value); - // await setDetectedLangauge(videoData, event.target.value); - // }); + menuOptions + .querySelector("#VOTTranslateFromLang") + .addEventListener("change", async (event) => { + debug.log("[onchange] select from language", event.target.value); + await setDetectedLangauge(videoData, event.target.value); + }); menuOptions .querySelector("#VOTTranslateToLang") @@ -621,7 +621,9 @@ async function main() { videoData.duration = video?.duration || 0; - videoData.videoId = getVideoId(siteHostname); + videoData.videoId = getVideoId(siteHostname) ; + + if (!videoData.videoId) return "Айди видео нет"; videoData.detectedLanguage = translateFromLang; @@ -841,7 +843,6 @@ async function main() { async function videoValidator() { if (window.location.hostname.includes("youtube.com")) { - await setDetectedLangauge(videoData, ytData.detectedLanguage); debug.log("VideoValidator videoData: ", videoData); if (dontTranslateYourLang === 1 && ytData.detectedLanguage === lang && ytData.responseLanguage === lang) { firstPlay = false; From 59edc2e54c1769355ae3e68eb82a65990a68e27f Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Thu, 27 Jul 2023 10:06:04 +0400 Subject: [PATCH 19/48] Add files via upload --- dist/vot-cloudflare-min.user.js | 2 +- dist/vot-cloudflare.user.js | 2 +- dist/vot-min.user.js | 2 +- dist/vot.user.js | 2 +- src/index.js | 41 ++++++++++++++++++++------------- src/utils/getYTVideoData.js | 1 - 6 files changed, 29 insertions(+), 21 deletions(-) diff --git a/dist/vot-cloudflare-min.user.js b/dist/vot-cloudflare-min.user.js index eb07a621..92748455 100644 --- a/dist/vot-cloudflare-min.user.js +++ b/dist/vot-cloudflare-min.user.js @@ -84,4 +84,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await async function(){const e={};if(e.duration=p?.duration||0,e.videoId=I(u),e.videoId)return e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(e.detectedLanguage=t,await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)y.Z.log(`lipsync mode is ${e}`),o.pause(),"abort"===e&&(y.Z.log("lipsync mode is abort"),await oe()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}function ae(t,a,i){!async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(`${v.g$[u]}${t}`,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.videoId?(e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e):"Айди видео нет"}();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(e.detectedLanguage=t,await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)y.Z.log(`lipsync mode is ${e}`),o.pause(),"abort"===e&&(y.Z.log("lipsync mode is abort"),await oe()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){!async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(`${v.g$[u]}${t}`,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot-cloudflare.user.js b/dist/vot-cloudflare.user.js index 757e8dbd..e634debe 100644 --- a/dist/vot-cloudflare.user.js +++ b/dist/vot-cloudflare.user.js @@ -3331,7 +3331,7 @@ async function src_main() { } // Define a function to translate a video and handle the callback - function translateFunc(VIDEO_ID, requestLang, responseLang) { + async function translateFunc(VIDEO_ID, requestLang, responseLang) { const videoURL = `${constants/* siteTranslates */.g$[siteHostname]}${VIDEO_ID}`; translateVideo( videoURL, diff --git a/dist/vot-min.user.js b/dist/vot-min.user.js index d4c6480b..bbbc295f 100644 --- a/dist/vot-min.user.js +++ b/dist/vot-min.user.js @@ -83,4 +83,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};if(e.duration=c?.duration||0,e.videoId=A(d),e.videoId)return e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(e.detectedLanguage=t,await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)f.log(`lipsync mode is ${e}`),a.pause(),"abort"===e&&(f.log("lipsync mode is abort"),await ae()),"playing"===e&&(f.log("lipsync mode is playing"),a.play());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}function oe(t,o,i){!async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(`${y[d]}${t}`,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.videoId?(e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e):"Айди видео нет"}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(e.detectedLanguage=t,await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)f.log(`lipsync mode is ${e}`),a.pause(),"abort"===e&&(f.log("lipsync mode is abort"),await ae()),"playing"===e&&(f.log("lipsync mode is playing"),a.play());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){!async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(`${y[d]}${t}`,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot.user.js b/dist/vot.user.js index 6bfb6595..126156d8 100644 --- a/dist/vot.user.js +++ b/dist/vot.user.js @@ -3260,7 +3260,7 @@ async function src_main() { } // Define a function to translate a video and handle the callback - function translateFunc(VIDEO_ID, requestLang, responseLang) { + async function translateFunc(VIDEO_ID, requestLang, responseLang) { const videoURL = `${siteTranslates[siteHostname]}${VIDEO_ID}`; translateVideo( videoURL, diff --git a/src/index.js b/src/index.js index 43b67095..85b15105 100644 --- a/src/index.js +++ b/src/index.js @@ -132,7 +132,13 @@ async function main() { debug.log("VOT: Added translation menu to ", element); } - async function translateVideo(url, unknown1, requestLang, responseLang, callback) { + async function translateVideo( + url, + unknown1, + requestLang, + responseLang, + callback + ) { debug.log( `Translate video (url: ${url}, unknown1: ${unknown1}, requestLang: ${requestLang}, responseLang: ${responseLang})` ); @@ -530,9 +536,9 @@ async function main() { console.log(`Set translation from ${from} to ${to}`); document.querySelector("#VOTTranslateFromLang").value = from; document.querySelector("#VOTTranslateToLang").value = to; - ytData.responseLanguage = to + ytData.responseLanguage = to; } - + // data - ytData or VideoData async function setDetectedLangauge(data, videolang) { data.detectedLanguage = videolang; @@ -542,15 +548,15 @@ async function main() { if (!Object.keys(availableLangs).includes(videolang)) { return setDetectedLangauge(data, "en"); } - + data.detectedLanguage = videolang; } - + await setSelectMenuValues(data.detectedLanguage, data.responseLanguage); - + return data; } - + // data - ytData or VideoData async function setResponseLangauge(data, videolang) { switch (videolang) { @@ -562,19 +568,18 @@ async function main() { if (!Object.keys(availableLangs).includes(videolang)) { return setResponseLangauge(data, "ru"); } - + if (data.detectedLanguage && data.responseLanguage === lang) { data.detectedLanguage = "en"; } - + data.responseLanguage = videolang; } - + await setSelectMenuValues(data.detectedLanguage, data.responseLanguage); - + return data; } - async function stopTraslate() { // Default actions on stop translate @@ -621,7 +626,7 @@ async function main() { videoData.duration = video?.duration || 0; - videoData.videoId = getVideoId(siteHostname) ; + videoData.videoId = getVideoId(siteHostname); if (!videoData.videoId) return "Айди видео нет"; @@ -844,7 +849,11 @@ async function main() { async function videoValidator() { if (window.location.hostname.includes("youtube.com")) { debug.log("VideoValidator videoData: ", videoData); - if (dontTranslateYourLang === 1 && ytData.detectedLanguage === lang && ytData.responseLanguage === lang) { + if ( + dontTranslateYourLang === 1 && + ytData.detectedLanguage === lang && + ytData.responseLanguage === lang + ) { firstPlay = false; throw translations[lang].VOTDisableFromYourLang; } @@ -887,7 +896,7 @@ async function main() { } // Define a function to translate a video and handle the callback - function translateFunc(VIDEO_ID, requestLang, responseLang) { + async function translateFunc(VIDEO_ID, requestLang, responseLang) { const videoURL = `${siteTranslates[siteHostname]}${VIDEO_ID}`; translateVideo( videoURL, @@ -1453,4 +1462,4 @@ async function main() { main().catch((e) => { console.error(e); -}); \ No newline at end of file +}); diff --git a/src/utils/getYTVideoData.js b/src/utils/getYTVideoData.js index 7478d6de..27f196cb 100644 --- a/src/utils/getYTVideoData.js +++ b/src/utils/getYTVideoData.js @@ -9,7 +9,6 @@ async function detect(cleanText) { return await response.text(); } - // Get the language code from the response or the text async function getLanguage(player, response, title, description, author) { if (!window.location.hostname.includes("m.youtube.com")) { From d0a04aa57ebeea1bf5f1af0aa7880fbf21d4eb94 Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Thu, 27 Jul 2023 10:33:23 +0400 Subject: [PATCH 20/48] Add files via upload --- dist/vot-cloudflare-min.user.js | 2 +- dist/vot-cloudflare.user.js | 42 ++++++++++++++++++++------------- dist/vot-min.user.js | 2 +- dist/vot.user.js | 42 ++++++++++++++++++++------------- src/index.js | 3 ++- 5 files changed, 56 insertions(+), 35 deletions(-) diff --git a/dist/vot-cloudflare-min.user.js b/dist/vot-cloudflare-min.user.js index 92748455..5c9b4101 100644 --- a/dist/vot-cloudflare-min.user.js +++ b/dist/vot-cloudflare-min.user.js @@ -84,4 +84,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.videoId?(e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e):"Айди видео нет"}();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(e.detectedLanguage=t,await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)y.Z.log(`lipsync mode is ${e}`),o.pause(),"abort"===e&&(y.Z.log("lipsync mode is abort"),await oe()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){!async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(`${v.g$[u]}${t}`,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.videoId?(e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e):"Айди видео нет"}();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(e.detectedLanguage=t,await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)y.Z.log(`lipsync mode is ${e}`),o.pause(),y.Z.log("lipsync mode is abort"),await oe(),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){!async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(`${v.g$[u]}${t}`,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","loadstart","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot-cloudflare.user.js b/dist/vot-cloudflare.user.js index e634debe..e92a7263 100644 --- a/dist/vot-cloudflare.user.js +++ b/dist/vot-cloudflare.user.js @@ -1570,7 +1570,6 @@ async function detect(cleanText) { return await response.text(); } - // Get the language code from the response or the text async function getLanguage(player, response, title, description, author) { if (!window.location.hostname.includes("m.youtube.com")) { @@ -2576,7 +2575,13 @@ async function src_main() { debug/* default */.Z.log("VOT: Added translation menu to ", element); } - async function translateVideo(url, unknown1, requestLang, responseLang, callback) { + async function translateVideo( + url, + unknown1, + requestLang, + responseLang, + callback + ) { debug/* default */.Z.log( `Translate video (url: ${url}, unknown1: ${unknown1}, requestLang: ${requestLang}, responseLang: ${responseLang})` ); @@ -2974,9 +2979,9 @@ async function src_main() { console.log(`Set translation from ${from} to ${to}`); document.querySelector("#VOTTranslateFromLang").value = from; document.querySelector("#VOTTranslateToLang").value = to; - ytData.responseLanguage = to + ytData.responseLanguage = to; } - + // data - ytData or VideoData async function setDetectedLangauge(data, videolang) { data.detectedLanguage = videolang; @@ -2986,15 +2991,15 @@ async function src_main() { if (!Object.keys(constants/* availableLangs */.tW).includes(videolang)) { return setDetectedLangauge(data, "en"); } - + data.detectedLanguage = videolang; } - + await setSelectMenuValues(data.detectedLanguage, data.responseLanguage); - + return data; } - + // data - ytData or VideoData async function setResponseLangauge(data, videolang) { switch (videolang) { @@ -3006,19 +3011,18 @@ async function src_main() { if (!Object.keys(constants/* availableLangs */.tW).includes(videolang)) { return setResponseLangauge(data, "ru"); } - + if (data.detectedLanguage && data.responseLanguage === lang) { data.detectedLanguage = "en"; } - + data.responseLanguage = videolang; } - + await setSelectMenuValues(data.detectedLanguage, data.responseLanguage); - + return data; } - async function stopTraslate() { // Default actions on stop translate @@ -3065,7 +3069,7 @@ async function src_main() { videoData.duration = video?.duration || 0; - videoData.videoId = getVideoId(siteHostname) ; + videoData.videoId = getVideoId(siteHostname); if (!videoData.videoId) return "Айди видео нет"; @@ -3131,7 +3135,7 @@ async function src_main() { debug/* default */.Z.log(`lipsync mode is ${mode}`); audio.pause(); } - if (mode === "abort") { + if (mode === "abort" || "loadstart") { debug/* default */.Z.log("lipsync mode is abort"); await stopTranslation(); } @@ -3288,7 +3292,11 @@ async function src_main() { async function videoValidator() { if (window.location.hostname.includes("youtube.com")) { debug/* default */.Z.log("VideoValidator videoData: ", videoData); - if (dontTranslateYourLang === 1 && ytData.detectedLanguage === lang && ytData.responseLanguage === lang) { + if ( + dontTranslateYourLang === 1 && + ytData.detectedLanguage === lang && + ytData.responseLanguage === lang + ) { firstPlay = false; throw constants/* translations */.Iz[lang].VOTDisableFromYourLang; } @@ -3441,6 +3449,7 @@ async function src_main() { "ratechange", "play", "abort", + "loadstart", "waiting", "pause", ]; @@ -3898,6 +3907,7 @@ async function src_main() { src_main().catch((e) => { console.error(e); }); + })(); /******/ })() diff --git a/dist/vot-min.user.js b/dist/vot-min.user.js index bbbc295f..cb4a9e35 100644 --- a/dist/vot-min.user.js +++ b/dist/vot-min.user.js @@ -83,4 +83,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.videoId?(e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e):"Айди видео нет"}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(e.detectedLanguage=t,await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)f.log(`lipsync mode is ${e}`),a.pause(),"abort"===e&&(f.log("lipsync mode is abort"),await ae()),"playing"===e&&(f.log("lipsync mode is playing"),a.play());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){!async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(`${y[d]}${t}`,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.videoId?(e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e):"Айди видео нет"}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(e.detectedLanguage=t,await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)f.log(`lipsync mode is ${e}`),a.pause(),f.log("lipsync mode is abort"),await ae(),"playing"===e&&(f.log("lipsync mode is playing"),a.play());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){!async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(`${y[d]}${t}`,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","loadstart","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot.user.js b/dist/vot.user.js index 126156d8..a3f063de 100644 --- a/dist/vot.user.js +++ b/dist/vot.user.js @@ -1084,7 +1084,6 @@ async function detect(cleanText) { return await response.text(); } - // Get the language code from the response or the text async function getLanguage(player, response, title, description, author) { if (!window.location.hostname.includes("m.youtube.com")) { @@ -2527,7 +2526,13 @@ async function src_main() { utils_debug.log("VOT: Added translation menu to ", element); } - async function translateVideo(url, unknown1, requestLang, responseLang, callback) { + async function translateVideo( + url, + unknown1, + requestLang, + responseLang, + callback + ) { utils_debug.log( `Translate video (url: ${url}, unknown1: ${unknown1}, requestLang: ${requestLang}, responseLang: ${responseLang})` ); @@ -2903,9 +2908,9 @@ async function src_main() { console.log(`Set translation from ${from} to ${to}`); document.querySelector("#VOTTranslateFromLang").value = from; document.querySelector("#VOTTranslateToLang").value = to; - ytData.responseLanguage = to + ytData.responseLanguage = to; } - + // data - ytData or VideoData async function setDetectedLangauge(data, videolang) { data.detectedLanguage = videolang; @@ -2915,15 +2920,15 @@ async function src_main() { if (!Object.keys(availableLangs).includes(videolang)) { return setDetectedLangauge(data, "en"); } - + data.detectedLanguage = videolang; } - + await setSelectMenuValues(data.detectedLanguage, data.responseLanguage); - + return data; } - + // data - ytData or VideoData async function setResponseLangauge(data, videolang) { switch (videolang) { @@ -2935,19 +2940,18 @@ async function src_main() { if (!Object.keys(availableLangs).includes(videolang)) { return setResponseLangauge(data, "ru"); } - + if (data.detectedLanguage && data.responseLanguage === lang) { data.detectedLanguage = "en"; } - + data.responseLanguage = videolang; } - + await setSelectMenuValues(data.detectedLanguage, data.responseLanguage); - + return data; } - async function stopTraslate() { // Default actions on stop translate @@ -2994,7 +2998,7 @@ async function src_main() { videoData.duration = video?.duration || 0; - videoData.videoId = getVideoId(siteHostname) ; + videoData.videoId = getVideoId(siteHostname); if (!videoData.videoId) return "Айди видео нет"; @@ -3060,7 +3064,7 @@ async function src_main() { utils_debug.log(`lipsync mode is ${mode}`); audio.pause(); } - if (mode === "abort") { + if (mode === "abort" || "loadstart") { utils_debug.log("lipsync mode is abort"); await stopTranslation(); } @@ -3217,7 +3221,11 @@ async function src_main() { async function videoValidator() { if (window.location.hostname.includes("youtube.com")) { utils_debug.log("VideoValidator videoData: ", videoData); - if (dontTranslateYourLang === 1 && ytData.detectedLanguage === lang && ytData.responseLanguage === lang) { + if ( + dontTranslateYourLang === 1 && + ytData.detectedLanguage === lang && + ytData.responseLanguage === lang + ) { firstPlay = false; throw translations[lang].VOTDisableFromYourLang; } @@ -3360,6 +3368,7 @@ async function src_main() { "ratechange", "play", "abort", + "loadstart", "waiting", "pause", ]; @@ -3817,6 +3826,7 @@ async function src_main() { src_main().catch((e) => { console.error(e); }); + })(); /******/ })() diff --git a/src/index.js b/src/index.js index 85b15105..cc699c39 100644 --- a/src/index.js +++ b/src/index.js @@ -692,7 +692,7 @@ async function main() { debug.log(`lipsync mode is ${mode}`); audio.pause(); } - if (mode === "abort") { + if (mode === "abort" || "loadstart") { debug.log("lipsync mode is abort"); await stopTranslation(); } @@ -1006,6 +1006,7 @@ async function main() { "ratechange", "play", "abort", + "loadstart", "waiting", "pause", ]; From 6f86aa3b5c283ad8a44fef2d7965975817d54af0 Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Thu, 27 Jul 2023 10:48:45 +0400 Subject: [PATCH 21/48] !responseLang check in translateFunc --- dist/vot-cloudflare-min.user.js | 2 +- dist/vot-cloudflare.user.js | 4 ++-- dist/vot-min.user.js | 2 +- dist/vot.user.js | 4 ++-- src/index.js | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dist/vot-cloudflare-min.user.js b/dist/vot-cloudflare-min.user.js index 5c9b4101..ea747d8d 100644 --- a/dist/vot-cloudflare-min.user.js +++ b/dist/vot-cloudflare-min.user.js @@ -84,4 +84,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.videoId?(e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e):"Айди видео нет"}();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(e.detectedLanguage=t,await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)y.Z.log(`lipsync mode is ${e}`),o.pause(),y.Z.log("lipsync mode is abort"),await oe(),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){!async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(`${v.g$[u]}${t}`,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","loadstart","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.videoId?(e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e):"Айди видео нет"}();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(e.detectedLanguage=t,await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)y.Z.log(`lipsync mode is ${e}`),o.pause(),"abort"===e&&(y.Z.log("lipsync mode is abort"),await oe()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){const s=`${v.g$[u]}${t}`;i||(ee=await Y(ee,ee.detectedLanguage)),async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot-cloudflare.user.js b/dist/vot-cloudflare.user.js index e92a7263..51fc03ff 100644 --- a/dist/vot-cloudflare.user.js +++ b/dist/vot-cloudflare.user.js @@ -3135,7 +3135,7 @@ async function src_main() { debug/* default */.Z.log(`lipsync mode is ${mode}`); audio.pause(); } - if (mode === "abort" || "loadstart") { + if (mode === "abort") { debug/* default */.Z.log("lipsync mode is abort"); await stopTranslation(); } @@ -3341,6 +3341,7 @@ async function src_main() { // Define a function to translate a video and handle the callback async function translateFunc(VIDEO_ID, requestLang, responseLang) { const videoURL = `${constants/* siteTranslates */.g$[siteHostname]}${VIDEO_ID}`; + if (!responseLang) ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); translateVideo( videoURL, constants/* translateFuncParam */.ey, @@ -3449,7 +3450,6 @@ async function src_main() { "ratechange", "play", "abort", - "loadstart", "waiting", "pause", ]; diff --git a/dist/vot-min.user.js b/dist/vot-min.user.js index cb4a9e35..feea3ba0 100644 --- a/dist/vot-min.user.js +++ b/dist/vot-min.user.js @@ -83,4 +83,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.videoId?(e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e):"Айди видео нет"}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(e.detectedLanguage=t,await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)f.log(`lipsync mode is ${e}`),a.pause(),f.log("lipsync mode is abort"),await ae(),"playing"===e&&(f.log("lipsync mode is playing"),a.play());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){!async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(`${y[d]}${t}`,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","loadstart","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.videoId?(e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e):"Айди видео нет"}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(e.detectedLanguage=t,await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)f.log(`lipsync mode is ${e}`),a.pause(),"abort"===e&&(f.log("lipsync mode is abort"),await ae()),"playing"===e&&(f.log("lipsync mode is playing"),a.play());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){const r=`${y[d]}${t}`;i||(te=await G(te,te.detectedLanguage)),async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot.user.js b/dist/vot.user.js index a3f063de..edb297fe 100644 --- a/dist/vot.user.js +++ b/dist/vot.user.js @@ -3064,7 +3064,7 @@ async function src_main() { utils_debug.log(`lipsync mode is ${mode}`); audio.pause(); } - if (mode === "abort" || "loadstart") { + if (mode === "abort") { utils_debug.log("lipsync mode is abort"); await stopTranslation(); } @@ -3270,6 +3270,7 @@ async function src_main() { // Define a function to translate a video and handle the callback async function translateFunc(VIDEO_ID, requestLang, responseLang) { const videoURL = `${siteTranslates[siteHostname]}${VIDEO_ID}`; + if (!responseLang) ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); translateVideo( videoURL, translateFuncParam, @@ -3368,7 +3369,6 @@ async function src_main() { "ratechange", "play", "abort", - "loadstart", "waiting", "pause", ]; diff --git a/src/index.js b/src/index.js index cc699c39..f9ad6437 100644 --- a/src/index.js +++ b/src/index.js @@ -692,7 +692,7 @@ async function main() { debug.log(`lipsync mode is ${mode}`); audio.pause(); } - if (mode === "abort" || "loadstart") { + if (mode === "abort") { debug.log("lipsync mode is abort"); await stopTranslation(); } @@ -898,6 +898,7 @@ async function main() { // Define a function to translate a video and handle the callback async function translateFunc(VIDEO_ID, requestLang, responseLang) { const videoURL = `${siteTranslates[siteHostname]}${VIDEO_ID}`; + if (!responseLang) ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); translateVideo( videoURL, translateFuncParam, @@ -1006,7 +1007,6 @@ async function main() { "ratechange", "play", "abort", - "loadstart", "waiting", "pause", ]; From c41f0c5316eda4e224dbee0e39225f9642a4682a Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Thu, 27 Jul 2023 10:54:07 +0400 Subject: [PATCH 22/48] Add files via upload --- dist/vot-cloudflare-min.user.js | 2 +- dist/vot-cloudflare.user.js | 7 +++---- dist/vot-min.user.js | 2 +- dist/vot.user.js | 7 +++---- src/index.js | 7 +++---- 5 files changed, 11 insertions(+), 14 deletions(-) diff --git a/dist/vot-cloudflare-min.user.js b/dist/vot-cloudflare-min.user.js index ea747d8d..bd662a81 100644 --- a/dist/vot-cloudflare-min.user.js +++ b/dist/vot-cloudflare-min.user.js @@ -84,4 +84,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.videoId?(e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e):"Айди видео нет"}();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(e.detectedLanguage=t,await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)y.Z.log(`lipsync mode is ${e}`),o.pause(),"abort"===e&&(y.Z.log("lipsync mode is abort"),await oe()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){const s=`${v.g$[u]}${t}`;i||(ee=await Y(ee,ee.detectedLanguage)),async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=await I(u),e.videoId?(e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e):"Айди видео нет"}();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(e.detectedLanguage=t,await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)y.Z.log(`lipsync mode is ${e}`),o.pause(),"abort"===e&&(y.Z.log("lipsync mode is abort"),await oe()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){!async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(`${v.g$[u]}${t}`,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=await I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=await I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot-cloudflare.user.js b/dist/vot-cloudflare.user.js index 51fc03ff..ba9ab3ca 100644 --- a/dist/vot-cloudflare.user.js +++ b/dist/vot-cloudflare.user.js @@ -3069,7 +3069,7 @@ async function src_main() { videoData.duration = video?.duration || 0; - videoData.videoId = getVideoId(siteHostname); + videoData.videoId = await getVideoId(siteHostname); if (!videoData.videoId) return "Айди видео нет"; @@ -3341,7 +3341,6 @@ async function src_main() { // Define a function to translate a video and handle the callback async function translateFunc(VIDEO_ID, requestLang, responseLang) { const videoURL = `${constants/* siteTranslates */.g$[siteHostname]}${VIDEO_ID}`; - if (!responseLang) ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); translateVideo( videoURL, constants/* translateFuncParam */.ey, @@ -3566,7 +3565,7 @@ async function src_main() { try { debug/* default */.Z.log("[click translationBtn] trying execute translation"); - const VIDEO_ID = getVideoId(siteHostname); + const VIDEO_ID = await getVideoId(siteHostname); if (!VIDEO_ID) { throw constants/* translations */.Iz[lang].VOTNoVideoIDFound; @@ -3585,7 +3584,7 @@ async function src_main() { if (!(firstPlay && dbAutoTranslate === 1)) { return; } - const VIDEO_ID = getVideoId(siteHostname); + const VIDEO_ID = await getVideoId(siteHostname); if (!VIDEO_ID) { throw constants/* translations */.Iz[lang].VOTNoVideoIDFound; diff --git a/dist/vot-min.user.js b/dist/vot-min.user.js index feea3ba0..3b7e6909 100644 --- a/dist/vot-min.user.js +++ b/dist/vot-min.user.js @@ -83,4 +83,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.videoId?(e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e):"Айди видео нет"}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(e.detectedLanguage=t,await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)f.log(`lipsync mode is ${e}`),a.pause(),"abort"===e&&(f.log("lipsync mode is abort"),await ae()),"playing"===e&&(f.log("lipsync mode is playing"),a.play());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){const r=`${y[d]}${t}`;i||(te=await G(te,te.detectedLanguage)),async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=await A(d),e.videoId?(e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e):"Айди видео нет"}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(e.detectedLanguage=t,await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)f.log(`lipsync mode is ${e}`),a.pause(),"abort"===e&&(f.log("lipsync mode is abort"),await ae()),"playing"===e&&(f.log("lipsync mode is playing"),a.play());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){!async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(`${y[d]}${t}`,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=await A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=await A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot.user.js b/dist/vot.user.js index edb297fe..d56a4262 100644 --- a/dist/vot.user.js +++ b/dist/vot.user.js @@ -2998,7 +2998,7 @@ async function src_main() { videoData.duration = video?.duration || 0; - videoData.videoId = getVideoId(siteHostname); + videoData.videoId = await getVideoId(siteHostname); if (!videoData.videoId) return "Айди видео нет"; @@ -3270,7 +3270,6 @@ async function src_main() { // Define a function to translate a video and handle the callback async function translateFunc(VIDEO_ID, requestLang, responseLang) { const videoURL = `${siteTranslates[siteHostname]}${VIDEO_ID}`; - if (!responseLang) ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); translateVideo( videoURL, translateFuncParam, @@ -3485,7 +3484,7 @@ async function src_main() { try { utils_debug.log("[click translationBtn] trying execute translation"); - const VIDEO_ID = getVideoId(siteHostname); + const VIDEO_ID = await getVideoId(siteHostname); if (!VIDEO_ID) { throw translations[lang].VOTNoVideoIDFound; @@ -3504,7 +3503,7 @@ async function src_main() { if (!(firstPlay && dbAutoTranslate === 1)) { return; } - const VIDEO_ID = getVideoId(siteHostname); + const VIDEO_ID = await getVideoId(siteHostname); if (!VIDEO_ID) { throw translations[lang].VOTNoVideoIDFound; diff --git a/src/index.js b/src/index.js index f9ad6437..4effa5ef 100644 --- a/src/index.js +++ b/src/index.js @@ -626,7 +626,7 @@ async function main() { videoData.duration = video?.duration || 0; - videoData.videoId = getVideoId(siteHostname); + videoData.videoId = await getVideoId(siteHostname); if (!videoData.videoId) return "Айди видео нет"; @@ -898,7 +898,6 @@ async function main() { // Define a function to translate a video and handle the callback async function translateFunc(VIDEO_ID, requestLang, responseLang) { const videoURL = `${siteTranslates[siteHostname]}${VIDEO_ID}`; - if (!responseLang) ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); translateVideo( videoURL, translateFuncParam, @@ -1123,7 +1122,7 @@ async function main() { try { debug.log("[click translationBtn] trying execute translation"); - const VIDEO_ID = getVideoId(siteHostname); + const VIDEO_ID = await getVideoId(siteHostname); if (!VIDEO_ID) { throw translations[lang].VOTNoVideoIDFound; @@ -1142,7 +1141,7 @@ async function main() { if (!(firstPlay && dbAutoTranslate === 1)) { return; } - const VIDEO_ID = getVideoId(siteHostname); + const VIDEO_ID = await getVideoId(siteHostname); if (!VIDEO_ID) { throw translations[lang].VOTNoVideoIDFound; From f7b9c10cad06969108fedea9bfc2e05a1626a74c Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Thu, 27 Jul 2023 11:57:34 +0400 Subject: [PATCH 23/48] Add files via upload --- dist/vot-cloudflare-min.user.js | 2 +- dist/vot-cloudflare.user.js | 30 +++++++++++++++++++----------- dist/vot-min.user.js | 2 +- dist/vot.user.js | 30 +++++++++++++++++++----------- src/index.js | 30 +++++++++++++++++++----------- 5 files changed, 59 insertions(+), 35 deletions(-) diff --git a/dist/vot-cloudflare-min.user.js b/dist/vot-cloudflare-min.user.js index bd662a81..12267c6f 100644 --- a/dist/vot-cloudflare-min.user.js +++ b/dist/vot-cloudflare-min.user.js @@ -84,4 +84,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=await I(u),e.videoId?(e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e):"Айди видео нет"}();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(e.detectedLanguage=t,await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)y.Z.log(`lipsync mode is ${e}`),o.pause(),"abort"===e&&(y.Z.log("lipsync mode is abort"),await oe()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){!async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(`${v.g$[u]}${t}`,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=await I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=await I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,M,z,A,q,E;y.Z.log("[translateProccessor] execute on element: ",n);let Z,$=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let _=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await W(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",_);const H="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(H);try{Z=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:_.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await W(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),_=await G(_,e.target.value)}))}if(Z){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,M=e.showVideoSlider,z=e.autoSetVolumeYandexStyle,A=e.dontTranslateYourLang,E=e.audioProxy,q=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&U&&!U.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==A&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",A,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),A=t,y.Z.log("dontTranslateYourLang value changed. New value: ",A)},U.appendChild(e)}if(void 0!==z&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",z,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),z=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",z)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",M,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),M=t,y.Z.log("showVideoSlider value changed. New value: ",M),1===M&&"success"===document.querySelector(".translationBtn").dataset.state?te():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==q&&U&&!U.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",q,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),q=t,y.Z.log("syncVolume value changed. New value: ",q)},U.appendChild(e)}if(void 0!==E&&U&&!U.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",E,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),E=t,y.Z.log("audioProxy value changed. New value: ",E)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function W(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(e.detectedLanguage=t,await Y(e.detectedLanguage,e.responseLanguage),e):W(e,"en")}async function G(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return G(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function K(){o.pause(),p.removeEventListener(".translate",K,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function J(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===q&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&J()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const X=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play()),"abort"===e&&(y.Z.log("lipsync mode is abort"),await ae());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function te(){if(1!==M||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!z?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==q)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const ne=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(await F(250),y.Z.log("VideoValidator videoData: ",_),1===A&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw $=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if(_.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ie(e,_.detectedLanguage,_.responseLanguage)};async function oe(e){y.Z.log(`video ${e.type}`),await X(e.type)}async function ae(){await K(),await J()}async function ie(t,a,i){const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ie(t,a,i)),6e4)),r;if(o.src=r,1===E&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof z&&z&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(ae(),$=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&X("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,oe))))),O("success",v.Iz[b].disableTranslate),await te(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===q&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const re=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?re(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&re(document.querySelector("#player"),["mousemove","mouseout"],l):re("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await K();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await ne(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!$||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await ne(t),$=!1}catch(e){O("error",String(e).substring(4,e.length)),$=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot-cloudflare.user.js b/dist/vot-cloudflare.user.js index ba9ab3ca..42fcb4b7 100644 --- a/dist/vot-cloudflare.user.js +++ b/dist/vot-cloudflare.user.js @@ -3069,9 +3069,7 @@ async function src_main() { videoData.duration = video?.duration || 0; - videoData.videoId = await getVideoId(siteHostname); - - if (!videoData.videoId) return "Айди видео нет"; + videoData.videoId = getVideoId(siteHostname); videoData.detectedLanguage = translateFromLang; @@ -3131,18 +3129,26 @@ async function src_main() { } return; } - if (mode === "pause" || "waiting" || 0) { - debug/* default */.Z.log(`lipsync mode is ${mode}`); + if (mode === "pause") { + debug/* default */.Z.log("lipsync mode is pause"); audio.pause(); } - if (mode === "abort") { - debug/* default */.Z.log("lipsync mode is abort"); - await stopTranslation(); + if (mode === "stop") { + debug/* default */.Z.log("lipsync mode is stop"); + audio.pause(); + } + if (mode === "waiting") { + debug/* default */.Z.log("lipsync mode is waiting"); + audio.pause(); } if (mode === "playing") { debug/* default */.Z.log("lipsync mode is playing"); audio.play(); } + if (mode === "abort") { + debug/* default */.Z.log("lipsync mode is abort"); + await stopTranslation(); + } }; async function addVideoSlider() { @@ -3291,6 +3297,7 @@ async function src_main() { async function videoValidator() { if (window.location.hostname.includes("youtube.com")) { + await sleep(250) debug/* default */.Z.log("VideoValidator videoData: ", videoData); if ( dontTranslateYourLang === 1 && @@ -3341,7 +3348,7 @@ async function src_main() { // Define a function to translate a video and handle the callback async function translateFunc(VIDEO_ID, requestLang, responseLang) { const videoURL = `${constants/* siteTranslates */.g$[siteHostname]}${VIDEO_ID}`; - translateVideo( + await translateVideo( videoURL, constants/* translateFuncParam */.ey, requestLang, @@ -3475,6 +3482,7 @@ async function src_main() { ); } + document.addEventListener("click", async (event) => { const block = document.querySelector(".translationBlock"); const menuContainer = document.querySelector(".translationMenuContent"); @@ -3565,7 +3573,7 @@ async function src_main() { try { debug/* default */.Z.log("[click translationBtn] trying execute translation"); - const VIDEO_ID = await getVideoId(siteHostname); + const VIDEO_ID = getVideoId(siteHostname); if (!VIDEO_ID) { throw constants/* translations */.Iz[lang].VOTNoVideoIDFound; @@ -3584,7 +3592,7 @@ async function src_main() { if (!(firstPlay && dbAutoTranslate === 1)) { return; } - const VIDEO_ID = await getVideoId(siteHostname); + const VIDEO_ID = getVideoId(siteHostname); if (!VIDEO_ID) { throw constants/* translations */.Iz[lang].VOTNoVideoIDFound; diff --git a/dist/vot-min.user.js b/dist/vot-min.user.js index 3b7e6909..cf6e33d4 100644 --- a/dist/vot-min.user.js +++ b/dist/vot-min.user.js @@ -83,4 +83,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=await A(d),e.videoId?(e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e):"Айди видео нет"}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(e.detectedLanguage=t,await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)f.log(`lipsync mode is ${e}`),a.pause(),"abort"===e&&(f.log("lipsync mode is abort"),await ae()),"playing"===e&&(f.log("lipsync mode is playing"),a.play());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){!async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(`${y[d]}${t}`,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=await A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=await A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,E,I,P,B;f.log("[translateProccessor] execute on element: ",n);let z,_=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let H=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await W(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",H);const U="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(U),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(U);try{z=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const Y=document.querySelector(".translationMenuOptions");if(Y&&!Y.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:H.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:H.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),Y.appendChild(n),Y.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),await W(H,e.target.value)})),Y.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),H=await Z(H,e.target.value)}))}if(z){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,E=e.autoSetVolumeYandexStyle,I=e.dontTranslateYourLang,B=e.audioProxy,P=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&Y&&!Y.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},Y.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==I&&Y&&!Y.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",I,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),I=t,f.log("dontTranslateYourLang value changed. New value: ",I)},Y.appendChild(e)}if(void 0!==E&&Y&&!Y.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",E,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),E=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",E)},Y.appendChild(e)}if(void 0!==D&&Y&&!Y.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?Q():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},Y.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==P&&Y&&!Y.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",P,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),P=t,f.log("syncVolume value changed. New value: ",P)},Y.appendChild(e)}}}async function G(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function W(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(e.detectedLanguage=t,await G(e.detectedLanguage,e.responseLanguage),e):W(e,"en")}async function Z(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return Z(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await G(e.detectedLanguage,e.responseLanguage),e}async function K(){a.pause(),c.removeEventListener(".translate",K,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function J(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===P&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&J()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const X=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(f.log("lipsync mode is pause"),a.pause()),"stop"===e&&(f.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(f.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(f.log("lipsync mode is playing"),a.play()),"abort"===e&&(f.log("lipsync mode is abort"),await oe());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function Q(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!E?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==P)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const ne=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(await M(250),f.log("VideoValidator videoData: ",H),1===I&&te.detectedLanguage===V&&te.responseLanguage===V)throw _=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(H.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await ie(e,H.detectedLanguage,H.responseLanguage)};async function ae(e){f.log(`video ${e.type}`),await X(e.type)}async function oe(){await K(),await J()}async function ie(t,o,i){const r=`${y[d]}${t}`;await async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>ie(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof E&&E&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(oe(),_=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&X("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ae))))),x("success",b[V].disableTranslate),await Q(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===P&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const re=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?re(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&re(document.querySelector("#player"),["mousemove","mouseout"],s):re("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await K();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await ne(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!_||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await ne(t),_=!1}catch(e){x("error",String(e).substring(4,e.length)),_=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot.user.js b/dist/vot.user.js index d56a4262..91440570 100644 --- a/dist/vot.user.js +++ b/dist/vot.user.js @@ -2998,9 +2998,7 @@ async function src_main() { videoData.duration = video?.duration || 0; - videoData.videoId = await getVideoId(siteHostname); - - if (!videoData.videoId) return "Айди видео нет"; + videoData.videoId = getVideoId(siteHostname); videoData.detectedLanguage = translateFromLang; @@ -3060,18 +3058,26 @@ async function src_main() { } return; } - if (mode === "pause" || "waiting" || 0) { - utils_debug.log(`lipsync mode is ${mode}`); + if (mode === "pause") { + utils_debug.log("lipsync mode is pause"); audio.pause(); } - if (mode === "abort") { - utils_debug.log("lipsync mode is abort"); - await stopTranslation(); + if (mode === "stop") { + utils_debug.log("lipsync mode is stop"); + audio.pause(); + } + if (mode === "waiting") { + utils_debug.log("lipsync mode is waiting"); + audio.pause(); } if (mode === "playing") { utils_debug.log("lipsync mode is playing"); audio.play(); } + if (mode === "abort") { + utils_debug.log("lipsync mode is abort"); + await stopTranslation(); + } }; async function addVideoSlider() { @@ -3220,6 +3226,7 @@ async function src_main() { async function videoValidator() { if (window.location.hostname.includes("youtube.com")) { + await sleep(250) utils_debug.log("VideoValidator videoData: ", videoData); if ( dontTranslateYourLang === 1 && @@ -3270,7 +3277,7 @@ async function src_main() { // Define a function to translate a video and handle the callback async function translateFunc(VIDEO_ID, requestLang, responseLang) { const videoURL = `${siteTranslates[siteHostname]}${VIDEO_ID}`; - translateVideo( + await translateVideo( videoURL, translateFuncParam, requestLang, @@ -3394,6 +3401,7 @@ async function src_main() { ); } + document.addEventListener("click", async (event) => { const block = document.querySelector(".translationBlock"); const menuContainer = document.querySelector(".translationMenuContent"); @@ -3484,7 +3492,7 @@ async function src_main() { try { utils_debug.log("[click translationBtn] trying execute translation"); - const VIDEO_ID = await getVideoId(siteHostname); + const VIDEO_ID = getVideoId(siteHostname); if (!VIDEO_ID) { throw translations[lang].VOTNoVideoIDFound; @@ -3503,7 +3511,7 @@ async function src_main() { if (!(firstPlay && dbAutoTranslate === 1)) { return; } - const VIDEO_ID = await getVideoId(siteHostname); + const VIDEO_ID = getVideoId(siteHostname); if (!VIDEO_ID) { throw translations[lang].VOTNoVideoIDFound; diff --git a/src/index.js b/src/index.js index 4effa5ef..9dc3d3fc 100644 --- a/src/index.js +++ b/src/index.js @@ -626,9 +626,7 @@ async function main() { videoData.duration = video?.duration || 0; - videoData.videoId = await getVideoId(siteHostname); - - if (!videoData.videoId) return "Айди видео нет"; + videoData.videoId = getVideoId(siteHostname); videoData.detectedLanguage = translateFromLang; @@ -688,18 +686,26 @@ async function main() { } return; } - if (mode === "pause" || "waiting" || "stop") { - debug.log(`lipsync mode is ${mode}`); + if (mode === "pause") { + debug.log("lipsync mode is pause"); audio.pause(); } - if (mode === "abort") { - debug.log("lipsync mode is abort"); - await stopTranslation(); + if (mode === "stop") { + debug.log("lipsync mode is stop"); + audio.pause(); + } + if (mode === "waiting") { + debug.log("lipsync mode is waiting"); + audio.pause(); } if (mode === "playing") { debug.log("lipsync mode is playing"); audio.play(); } + if (mode === "abort") { + debug.log("lipsync mode is abort"); + await stopTranslation(); + } }; async function addVideoSlider() { @@ -848,6 +854,7 @@ async function main() { async function videoValidator() { if (window.location.hostname.includes("youtube.com")) { + await sleep(250) debug.log("VideoValidator videoData: ", videoData); if ( dontTranslateYourLang === 1 && @@ -898,7 +905,7 @@ async function main() { // Define a function to translate a video and handle the callback async function translateFunc(VIDEO_ID, requestLang, responseLang) { const videoURL = `${siteTranslates[siteHostname]}${VIDEO_ID}`; - translateVideo( + await translateVideo( videoURL, translateFuncParam, requestLang, @@ -1032,6 +1039,7 @@ async function main() { ); } + document.addEventListener("click", async (event) => { const block = document.querySelector(".translationBlock"); const menuContainer = document.querySelector(".translationMenuContent"); @@ -1122,7 +1130,7 @@ async function main() { try { debug.log("[click translationBtn] trying execute translation"); - const VIDEO_ID = await getVideoId(siteHostname); + const VIDEO_ID = getVideoId(siteHostname); if (!VIDEO_ID) { throw translations[lang].VOTNoVideoIDFound; @@ -1141,7 +1149,7 @@ async function main() { if (!(firstPlay && dbAutoTranslate === 1)) { return; } - const VIDEO_ID = await getVideoId(siteHostname); + const VIDEO_ID = getVideoId(siteHostname); if (!VIDEO_ID) { throw translations[lang].VOTNoVideoIDFound; From 4db2761c64de18b3e980a511a754b137b299f2a2 Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Thu, 27 Jul 2023 12:01:53 +0400 Subject: [PATCH 24/48] Add files via upload --- dist/vot-cloudflare-min.user.js | 2 +- dist/vot-cloudflare.user.js | 2 +- dist/vot-min.user.js | 2 +- dist/vot.user.js | 2 +- src/index.js | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dist/vot-cloudflare-min.user.js b/dist/vot-cloudflare-min.user.js index 12267c6f..2ccb3945 100644 --- a/dist/vot-cloudflare-min.user.js +++ b/dist/vot-cloudflare-min.user.js @@ -84,4 +84,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,M,z,A,q,E;y.Z.log("[translateProccessor] execute on element: ",n);let Z,$=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let _=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await W(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",_);const H="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(H);try{Z=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:_.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await W(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),_=await G(_,e.target.value)}))}if(Z){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,M=e.showVideoSlider,z=e.autoSetVolumeYandexStyle,A=e.dontTranslateYourLang,E=e.audioProxy,q=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&U&&!U.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==A&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",A,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),A=t,y.Z.log("dontTranslateYourLang value changed. New value: ",A)},U.appendChild(e)}if(void 0!==z&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",z,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),z=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",z)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",M,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),M=t,y.Z.log("showVideoSlider value changed. New value: ",M),1===M&&"success"===document.querySelector(".translationBtn").dataset.state?te():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==q&&U&&!U.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",q,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),q=t,y.Z.log("syncVolume value changed. New value: ",q)},U.appendChild(e)}if(void 0!==E&&U&&!U.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",E,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),E=t,y.Z.log("audioProxy value changed. New value: ",E)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function W(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(e.detectedLanguage=t,await Y(e.detectedLanguage,e.responseLanguage),e):W(e,"en")}async function G(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return G(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function K(){o.pause(),p.removeEventListener(".translate",K,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function J(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===q&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&J()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const X=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play()),"abort"===e&&(y.Z.log("lipsync mode is abort"),await ae());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function te(){if(1!==M||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!z?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==q)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const ne=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(await F(250),y.Z.log("VideoValidator videoData: ",_),1===A&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw $=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if(_.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ie(e,_.detectedLanguage,_.responseLanguage)};async function oe(e){y.Z.log(`video ${e.type}`),await X(e.type)}async function ae(){await K(),await J()}async function ie(t,a,i){const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ie(t,a,i)),6e4)),r;if(o.src=r,1===E&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof z&&z&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(ae(),$=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&X("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,oe))))),O("success",v.Iz[b].disableTranslate),await te(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===q&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const re=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?re(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&re(document.querySelector("#player"),["mousemove","mouseout"],l):re("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await K();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await ne(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!$||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await ne(t),$=!1}catch(e){O("error",String(e).substring(4,e.length)),$=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await J();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?te():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(e.detectedLanguage=t,await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}async function J(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const X=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play()),"abort"===e&&(y.Z.log("lipsync mode is abort"),await ae());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function te(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const ne=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(await J(),y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ie(e,$.detectedLanguage,$.responseLanguage)};async function oe(e){y.Z.log(`video ${e.type}`),await X(e.type)}async function ae(){await G(),await K()}async function ie(t,a,i){const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ie(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(ae(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&X("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,oe))))),O("success",v.Iz[b].disableTranslate),await te(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const re=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?re(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&re(document.querySelector("#player"),["mousemove","mouseout"],l):re("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await ne(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await ne(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot-cloudflare.user.js b/dist/vot-cloudflare.user.js index 42fcb4b7..69870ae8 100644 --- a/dist/vot-cloudflare.user.js +++ b/dist/vot-cloudflare.user.js @@ -3297,7 +3297,7 @@ async function src_main() { async function videoValidator() { if (window.location.hostname.includes("youtube.com")) { - await sleep(250) + await getVideoData() debug/* default */.Z.log("VideoValidator videoData: ", videoData); if ( dontTranslateYourLang === 1 && diff --git a/dist/vot-min.user.js b/dist/vot-min.user.js index cf6e33d4..d23fd1ed 100644 --- a/dist/vot-min.user.js +++ b/dist/vot-min.user.js @@ -83,4 +83,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,E,I,P,B;f.log("[translateProccessor] execute on element: ",n);let z,_=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let H=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await W(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",H);const U="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(U),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(U);try{z=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const Y=document.querySelector(".translationMenuOptions");if(Y&&!Y.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:H.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:H.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),Y.appendChild(n),Y.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),await W(H,e.target.value)})),Y.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),H=await Z(H,e.target.value)}))}if(z){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,E=e.autoSetVolumeYandexStyle,I=e.dontTranslateYourLang,B=e.audioProxy,P=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&Y&&!Y.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},Y.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==I&&Y&&!Y.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",I,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),I=t,f.log("dontTranslateYourLang value changed. New value: ",I)},Y.appendChild(e)}if(void 0!==E&&Y&&!Y.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",E,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),E=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",E)},Y.appendChild(e)}if(void 0!==D&&Y&&!Y.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?Q():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},Y.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==P&&Y&&!Y.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",P,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),P=t,f.log("syncVolume value changed. New value: ",P)},Y.appendChild(e)}}}async function G(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function W(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(e.detectedLanguage=t,await G(e.detectedLanguage,e.responseLanguage),e):W(e,"en")}async function Z(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return Z(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await G(e.detectedLanguage,e.responseLanguage),e}async function K(){a.pause(),c.removeEventListener(".translate",K,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function J(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===P&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&J()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const X=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(f.log("lipsync mode is pause"),a.pause()),"stop"===e&&(f.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(f.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(f.log("lipsync mode is playing"),a.play()),"abort"===e&&(f.log("lipsync mode is abort"),await oe());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function Q(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!E?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==P)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const ne=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(await M(250),f.log("VideoValidator videoData: ",H),1===I&&te.detectedLanguage===V&&te.responseLanguage===V)throw _=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(H.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await ie(e,H.detectedLanguage,H.responseLanguage)};async function ae(e){f.log(`video ${e.type}`),await X(e.type)}async function oe(){await K(),await J()}async function ie(t,o,i){const r=`${y[d]}${t}`;await async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>ie(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof E&&E&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(oe(),_=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&X("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ae))))),x("success",b[V].disableTranslate),await Q(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===P&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const re=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?re(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&re(document.querySelector("#player"),["mousemove","mouseout"],s):re("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await K();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await ne(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!_||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await ne(t),_=!1}catch(e){x("error",String(e).substring(4,e.length)),_=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await J();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?Q():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(e.detectedLanguage=t,await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}async function J(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const X=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(f.log("lipsync mode is pause"),a.pause()),"stop"===e&&(f.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(f.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(f.log("lipsync mode is playing"),a.play()),"abort"===e&&(f.log("lipsync mode is abort"),await oe());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function Q(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const ne=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(await J(),f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await ie(e,_.detectedLanguage,_.responseLanguage)};async function ae(e){f.log(`video ${e.type}`),await X(e.type)}async function oe(){await Z(),await K()}async function ie(t,o,i){const r=`${y[d]}${t}`;await async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>ie(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(oe(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&X("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ae))))),x("success",b[V].disableTranslate),await Q(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const re=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?re(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&re(document.querySelector("#player"),["mousemove","mouseout"],s):re("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await ne(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await ne(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot.user.js b/dist/vot.user.js index 91440570..e3f9e433 100644 --- a/dist/vot.user.js +++ b/dist/vot.user.js @@ -3226,7 +3226,7 @@ async function src_main() { async function videoValidator() { if (window.location.hostname.includes("youtube.com")) { - await sleep(250) + await getVideoData() utils_debug.log("VideoValidator videoData: ", videoData); if ( dontTranslateYourLang === 1 && diff --git a/src/index.js b/src/index.js index 9dc3d3fc..23ff27e9 100644 --- a/src/index.js +++ b/src/index.js @@ -854,7 +854,7 @@ async function main() { async function videoValidator() { if (window.location.hostname.includes("youtube.com")) { - await sleep(250) + await getVideoData() debug.log("VideoValidator videoData: ", videoData); if ( dontTranslateYourLang === 1 && From 7e4bae44c9bcb4df5f1f91e9b7404d8a3299e191 Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Thu, 27 Jul 2023 12:05:35 +0400 Subject: [PATCH 25/48] =?UTF-8?q?=D0=AF=20=D1=83=D1=81=D1=82=D0=B0=D0=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/vot-cloudflare-min.user.js | 2 +- dist/vot-cloudflare.user.js | 2 +- dist/vot-min.user.js | 2 +- dist/vot.user.js | 2 +- src/index.js | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dist/vot-cloudflare-min.user.js b/dist/vot-cloudflare-min.user.js index 2ccb3945..f60720c0 100644 --- a/dist/vot-cloudflare-min.user.js +++ b/dist/vot-cloudflare-min.user.js @@ -84,4 +84,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await J();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?te():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(e.detectedLanguage=t,await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}async function J(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const X=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play()),"abort"===e&&(y.Z.log("lipsync mode is abort"),await ae());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function te(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const ne=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(await J(),y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ie(e,$.detectedLanguage,$.responseLanguage)};async function oe(e){y.Z.log(`video ${e.type}`),await X(e.type)}async function ae(){await G(),await K()}async function ie(t,a,i){const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ie(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(ae(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&X("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,oe))))),O("success",v.Iz[b].disableTranslate),await te(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const re=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?re(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&re(document.querySelector("#player"),["mousemove","mouseout"],l):re("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await ne(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await ne(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await J();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?te():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(e.detectedLanguage=t,await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}async function J(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const X=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play()),"abort"===e&&(y.Z.log("lipsync mode is abort"),await ae());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function te(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const ne=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if($=await J(),y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ie(e,$.detectedLanguage,$.responseLanguage)};async function oe(e){y.Z.log(`video ${e.type}`),await X(e.type)}async function ae(){await G(),await K()}async function ie(t,a,i){const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ie(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(ae(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&X("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,oe))))),O("success",v.Iz[b].disableTranslate),await te(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const re=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?re(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&re(document.querySelector("#player"),["mousemove","mouseout"],l):re("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await ne(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await ne(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot-cloudflare.user.js b/dist/vot-cloudflare.user.js index 69870ae8..7d8317df 100644 --- a/dist/vot-cloudflare.user.js +++ b/dist/vot-cloudflare.user.js @@ -3297,7 +3297,7 @@ async function src_main() { async function videoValidator() { if (window.location.hostname.includes("youtube.com")) { - await getVideoData() + videoData = await getVideoData() debug/* default */.Z.log("VideoValidator videoData: ", videoData); if ( dontTranslateYourLang === 1 && diff --git a/dist/vot-min.user.js b/dist/vot-min.user.js index d23fd1ed..c381aeb7 100644 --- a/dist/vot-min.user.js +++ b/dist/vot-min.user.js @@ -83,4 +83,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await J();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?Q():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(e.detectedLanguage=t,await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}async function J(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const X=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(f.log("lipsync mode is pause"),a.pause()),"stop"===e&&(f.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(f.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(f.log("lipsync mode is playing"),a.play()),"abort"===e&&(f.log("lipsync mode is abort"),await oe());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function Q(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const ne=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(await J(),f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await ie(e,_.detectedLanguage,_.responseLanguage)};async function ae(e){f.log(`video ${e.type}`),await X(e.type)}async function oe(){await Z(),await K()}async function ie(t,o,i){const r=`${y[d]}${t}`;await async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>ie(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(oe(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&X("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ae))))),x("success",b[V].disableTranslate),await Q(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const re=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?re(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&re(document.querySelector("#player"),["mousemove","mouseout"],s):re("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await ne(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await ne(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await J();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?Q():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(e.detectedLanguage=t,await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}async function J(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const X=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(f.log("lipsync mode is pause"),a.pause()),"stop"===e&&(f.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(f.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(f.log("lipsync mode is playing"),a.play()),"abort"===e&&(f.log("lipsync mode is abort"),await oe());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function Q(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const ne=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(_=await J(),f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await ie(e,_.detectedLanguage,_.responseLanguage)};async function ae(e){f.log(`video ${e.type}`),await X(e.type)}async function oe(){await Z(),await K()}async function ie(t,o,i){const r=`${y[d]}${t}`;await async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>ie(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(oe(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&X("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ae))))),x("success",b[V].disableTranslate),await Q(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const re=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?re(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&re(document.querySelector("#player"),["mousemove","mouseout"],s):re("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await ne(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await ne(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot.user.js b/dist/vot.user.js index e3f9e433..0e999c88 100644 --- a/dist/vot.user.js +++ b/dist/vot.user.js @@ -3226,7 +3226,7 @@ async function src_main() { async function videoValidator() { if (window.location.hostname.includes("youtube.com")) { - await getVideoData() + videoData = await getVideoData() utils_debug.log("VideoValidator videoData: ", videoData); if ( dontTranslateYourLang === 1 && diff --git a/src/index.js b/src/index.js index 23ff27e9..111e4050 100644 --- a/src/index.js +++ b/src/index.js @@ -854,7 +854,7 @@ async function main() { async function videoValidator() { if (window.location.hostname.includes("youtube.com")) { - await getVideoData() + videoData = await getVideoData() debug.log("VideoValidator videoData: ", videoData); if ( dontTranslateYourLang === 1 && From 47cd2ee960f6094fc6a08a49c33fd693fc159441 Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Fri, 28 Jul 2023 01:24:46 +0400 Subject: [PATCH 26/48] Add files via upload --- dist/vot-cloudflare-min.user.js | 2 +- dist/vot-cloudflare.user.js | 2 +- dist/vot-min.user.js | 2 +- dist/vot.user.js | 2 +- src/index.js | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dist/vot-cloudflare-min.user.js b/dist/vot-cloudflare-min.user.js index f60720c0..e4096932 100644 --- a/dist/vot-cloudflare-min.user.js +++ b/dist/vot-cloudflare-min.user.js @@ -84,4 +84,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await J();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?te():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(e.detectedLanguage=t,await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}async function J(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const X=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play()),"abort"===e&&(y.Z.log("lipsync mode is abort"),await ae());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function te(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const ne=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if($=await J(),y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ie(e,$.detectedLanguage,$.responseLanguage)};async function oe(e){y.Z.log(`video ${e.type}`),await X(e.type)}async function ae(){await G(),await K()}async function ie(t,a,i){const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ie(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(ae(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&X("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,oe))))),O("success",v.Iz[b].disableTranslate),await te(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const re=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?re(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&re(document.querySelector("#player"),["mousemove","mouseout"],l):re("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await ne(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await ne(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let f=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function b(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),b("#7A7A7D"),V(e);break;case"success":w(e),b("#A36EFF"),V(e);break;default:w("none"),b("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}f in v.Iz||(f="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[f].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[f].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[f].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[f].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[f].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[f].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${f}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,b,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await async function(){const e={};if(e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")){if(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),!e.videoId)return;ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage}else window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh");return e}();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[f].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[f].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[f].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[f][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[f].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[f][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[f].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[f].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[f].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[f].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[f].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[f].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[f].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[f].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[f].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[f].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[f].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=f,Object.keys(v.tW).includes(t)?(e.detectedLanguage=t,await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==f&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===f&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[f].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(b=Number(e))}O("none",v.Iz[f].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play()),"abort"===e&&(y.Z.log("lipsync mode is abort"),await oe());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[f].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[f].neededAdditionalExtension:v.Iz[f].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);b=e;const t=x("VOTVideoSlider",e,`${v.Iz[f].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,b);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,b=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===f&&ee.responseLanguage===f)throw Z=!1,v.Iz[f].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[f].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[f].VOTPremiere;if($.duration>14400)throw v.Iz[f].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[f].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[f].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[f].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[f].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[f].translationTakeAboutMinute:v.Iz[f].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[f].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[f].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[f].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[f].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;b=e;const t=x("VOTTranslationSlider",e,`${v.Iz[f].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),b=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[f].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[f].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot-cloudflare.user.js b/dist/vot-cloudflare.user.js index 7d8317df..a10fbc0a 100644 --- a/dist/vot-cloudflare.user.js +++ b/dist/vot-cloudflare.user.js @@ -3077,6 +3077,7 @@ async function src_main() { if (window.location.hostname.includes("youtube.com")) { ytData = await getYTVideoData(); + if (!videoData.videoId) return; ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); videoData.detectedLanguage = ytData.detectedLanguage; videoData.responseLanguage = ytData.responseLanguage; @@ -3297,7 +3298,6 @@ async function src_main() { async function videoValidator() { if (window.location.hostname.includes("youtube.com")) { - videoData = await getVideoData() debug/* default */.Z.log("VideoValidator videoData: ", videoData); if ( dontTranslateYourLang === 1 && diff --git a/dist/vot-min.user.js b/dist/vot-min.user.js index c381aeb7..9a90ead1 100644 --- a/dist/vot-min.user.js +++ b/dist/vot-min.user.js @@ -83,4 +83,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await J();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?Q():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(e.detectedLanguage=t,await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}async function J(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const X=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(f.log("lipsync mode is pause"),a.pause()),"stop"===e&&(f.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(f.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(f.log("lipsync mode is playing"),a.play()),"abort"===e&&(f.log("lipsync mode is abort"),await oe());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function Q(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const ne=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(_=await J(),f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await ie(e,_.detectedLanguage,_.responseLanguage)};async function ae(e){f.log(`video ${e.type}`),await X(e.type)}async function oe(){await Z(),await K()}async function ie(t,o,i){const r=`${y[d]}${t}`;await async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>ie(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(oe(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&X("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ae))))),x("success",b[V].disableTranslate),await Q(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const re=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?re(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&re(document.querySelector("#player"),["mousemove","mouseout"],s):re("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await ne(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await ne(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};if(e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")){if(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),!e.videoId)return;te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage}else window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh");return e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(e.detectedLanguage=t,await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(f.log("lipsync mode is pause"),a.pause()),"stop"===e&&(f.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(f.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(f.log("lipsync mode is playing"),a.play()),"abort"===e&&(f.log("lipsync mode is abort"),await ae());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){const r=`${y[d]}${t}`;await async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot.user.js b/dist/vot.user.js index 0e999c88..14866bae 100644 --- a/dist/vot.user.js +++ b/dist/vot.user.js @@ -3006,6 +3006,7 @@ async function src_main() { if (window.location.hostname.includes("youtube.com")) { ytData = await getYTVideoData(); + if (!videoData.videoId) return; ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); videoData.detectedLanguage = ytData.detectedLanguage; videoData.responseLanguage = ytData.responseLanguage; @@ -3226,7 +3227,6 @@ async function src_main() { async function videoValidator() { if (window.location.hostname.includes("youtube.com")) { - videoData = await getVideoData() utils_debug.log("VideoValidator videoData: ", videoData); if ( dontTranslateYourLang === 1 && diff --git a/src/index.js b/src/index.js index 111e4050..cb40ac01 100644 --- a/src/index.js +++ b/src/index.js @@ -634,6 +634,7 @@ async function main() { if (window.location.hostname.includes("youtube.com")) { ytData = await getYTVideoData(); + if (!videoData.videoId) return; ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); videoData.detectedLanguage = ytData.detectedLanguage; videoData.responseLanguage = ytData.responseLanguage; @@ -854,7 +855,6 @@ async function main() { async function videoValidator() { if (window.location.hostname.includes("youtube.com")) { - videoData = await getVideoData() debug.log("VideoValidator videoData: ", videoData); if ( dontTranslateYourLang === 1 && From 6cdc5d832adb4b9a11698a6537e4244d51de9dd7 Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Sat, 29 Jul 2023 17:15:52 +0400 Subject: [PATCH 27/48] Add files via upload --- dist/vot-cloudflare-min.user.js | 2 +- dist/vot-cloudflare.user.js | 9 ++++----- dist/vot-min.user.js | 2 +- dist/vot.user.js | 9 ++++----- src/index.js | 10 +++++----- 5 files changed, 15 insertions(+), 17 deletions(-) diff --git a/dist/vot-cloudflare-min.user.js b/dist/vot-cloudflare-min.user.js index e4096932..5b8cd83e 100644 --- a/dist/vot-cloudflare-min.user.js +++ b/dist/vot-cloudflare-min.user.js @@ -84,4 +84,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let f=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function b(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),b("#7A7A7D"),V(e);break;case"success":w(e),b("#A36EFF"),V(e);break;default:w("none"),b("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}f in v.Iz||(f="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[f].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[f].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[f].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[f].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[f].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[f].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${f}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,b,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await async function(){const e={};if(e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")){if(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),!e.videoId)return;ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage}else window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh");return e}();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[f].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[f].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[f].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[f][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[f].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[f][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[f].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[f].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[f].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[f].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[f].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[f].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[f].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[f].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[f].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[f].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[f].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=f,Object.keys(v.tW).includes(t)?(e.detectedLanguage=t,await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==f&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===f&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[f].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(b=Number(e))}O("none",v.Iz[f].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play()),"abort"===e&&(y.Z.log("lipsync mode is abort"),await oe());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[f].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[f].neededAdditionalExtension:v.Iz[f].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);b=e;const t=x("VOTVideoSlider",e,`${v.Iz[f].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,b);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,b=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===f&&ee.responseLanguage===f)throw Z=!1,v.Iz[f].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[f].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[f].VOTPremiere;if($.duration>14400)throw v.Iz[f].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[f].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[f].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[f].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[f].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[f].translationTakeAboutMinute:v.Iz[f].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[f].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[f].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[f].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[f].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;b=e;const t=x("VOTTranslationSlider",e,`${v.Iz[f].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),b=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[f].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[f].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let f=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function b(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),b("#7A7A7D"),V(e);break;case"success":w(e),b("#A36EFF"),V(e);break;default:w("none"),b("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}f in v.Iz||(f="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[f].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[f].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[f].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[f].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[f].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[f].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${f}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,b,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await async function(){const e={};if(e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")){if(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),!e.videoId)return ee.detectedLanguage,ee.responseLanguage;ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage}else window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh");return e}();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[f].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[f].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[f].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[f][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[f].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[f][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[f].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[f].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[f].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[f].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[f].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[f].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[f].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[f].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[f].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[f].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[f].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=f,Object.keys(v.tW).includes(t)?(e.detectedLanguage=t,await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==f&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===f&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[f].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(b=Number(e))}O("none",v.Iz[f].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play()),"abort"===e&&(y.Z.log("lipsync mode is abort"),await oe());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[f].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[f].neededAdditionalExtension:v.Iz[f].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);b=e;const t=x("VOTVideoSlider",e,`${v.Iz[f].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,b);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,b=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===f&&ee.responseLanguage===f)throw Z=!1,v.Iz[f].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[f].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[f].VOTPremiere;if($.duration>14400)throw v.Iz[f].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[f].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[f].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[f].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[f].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[f].translationTakeAboutMinute:v.Iz[f].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[f].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[f].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[f].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[f].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;b=e;const t=x("VOTTranslationSlider",e,`${v.Iz[f].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),b=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[f].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[f].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot-cloudflare.user.js b/dist/vot-cloudflare.user.js index a10fbc0a..59245c1c 100644 --- a/dist/vot-cloudflare.user.js +++ b/dist/vot-cloudflare.user.js @@ -3077,7 +3077,7 @@ async function src_main() { if (window.location.hostname.includes("youtube.com")) { ytData = await getYTVideoData(); - if (!videoData.videoId) return; + if (!videoData.videoId) return ytData.detectedLanguage, ytData.responseLanguage; ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); videoData.detectedLanguage = ytData.detectedLanguage; videoData.responseLanguage = ytData.responseLanguage; @@ -3642,7 +3642,7 @@ async function src_main() { document.addEventListener("spfdone", ytPageEnter); document.addEventListener("yt-navigate-finish", ytPageEnter); - const ytPageLeave = () => { + const ytPageLeave = async () => { document.body.dispatchEvent(new Event("yt-translate-stop")); }; @@ -3679,9 +3679,9 @@ async function src_main() { attributeOldValue: true, }); } - const ytPageLeave = () => { + const ytPageLeave = async () => { document.body.dispatchEvent(new Event("yt-translate-stop")); - }; + }; document.addEventListener("spfdone", ytPageLeave); document.addEventListener("yt-navigate-finish", ytPageLeave); document.addEventListener("spfrequest", ytPageLeave); @@ -3914,7 +3914,6 @@ async function src_main() { src_main().catch((e) => { console.error(e); }); - })(); /******/ })() diff --git a/dist/vot-min.user.js b/dist/vot-min.user.js index 9a90ead1..f2ff0298 100644 --- a/dist/vot-min.user.js +++ b/dist/vot-min.user.js @@ -83,4 +83,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};if(e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")){if(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),!e.videoId)return;te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage}else window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh");return e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(e.detectedLanguage=t,await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(f.log("lipsync mode is pause"),a.pause()),"stop"===e&&(f.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(f.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(f.log("lipsync mode is playing"),a.play()),"abort"===e&&(f.log("lipsync mode is abort"),await ae());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){const r=`${y[d]}${t}`;await async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};if(e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")){if(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),!e.videoId)return te.detectedLanguage,te.responseLanguage;te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage}else window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh");return e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(e.detectedLanguage=t,await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(f.log("lipsync mode is pause"),a.pause()),"stop"===e&&(f.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(f.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(f.log("lipsync mode is playing"),a.play()),"abort"===e&&(f.log("lipsync mode is abort"),await ae());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){const r=`${y[d]}${t}`;await async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot.user.js b/dist/vot.user.js index 14866bae..25136ac7 100644 --- a/dist/vot.user.js +++ b/dist/vot.user.js @@ -3006,7 +3006,7 @@ async function src_main() { if (window.location.hostname.includes("youtube.com")) { ytData = await getYTVideoData(); - if (!videoData.videoId) return; + if (!videoData.videoId) return ytData.detectedLanguage, ytData.responseLanguage; ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); videoData.detectedLanguage = ytData.detectedLanguage; videoData.responseLanguage = ytData.responseLanguage; @@ -3561,7 +3561,7 @@ async function src_main() { document.addEventListener("spfdone", ytPageEnter); document.addEventListener("yt-navigate-finish", ytPageEnter); - const ytPageLeave = () => { + const ytPageLeave = async () => { document.body.dispatchEvent(new Event("yt-translate-stop")); }; @@ -3598,9 +3598,9 @@ async function src_main() { attributeOldValue: true, }); } - const ytPageLeave = () => { + const ytPageLeave = async () => { document.body.dispatchEvent(new Event("yt-translate-stop")); - }; + }; document.addEventListener("spfdone", ytPageLeave); document.addEventListener("yt-navigate-finish", ytPageLeave); document.addEventListener("spfrequest", ytPageLeave); @@ -3833,7 +3833,6 @@ async function src_main() { src_main().catch((e) => { console.error(e); }); - })(); /******/ })() diff --git a/src/index.js b/src/index.js index cb40ac01..351b69c0 100644 --- a/src/index.js +++ b/src/index.js @@ -634,7 +634,7 @@ async function main() { if (window.location.hostname.includes("youtube.com")) { ytData = await getYTVideoData(); - if (!videoData.videoId) return; + if (!videoData.videoId) return ytData.detectedLanguage, ytData.responseLanguage; ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); videoData.detectedLanguage = ytData.detectedLanguage; videoData.responseLanguage = ytData.responseLanguage; @@ -1199,7 +1199,7 @@ async function main() { document.addEventListener("spfdone", ytPageEnter); document.addEventListener("yt-navigate-finish", ytPageEnter); - const ytPageLeave = () => { + const ytPageLeave = async () => { document.body.dispatchEvent(new Event("yt-translate-stop")); }; @@ -1236,9 +1236,9 @@ async function main() { attributeOldValue: true, }); } - const ytPageLeave = () => { + const ytPageLeave = async () => { document.body.dispatchEvent(new Event("yt-translate-stop")); - }; + }; document.addEventListener("spfdone", ytPageLeave); document.addEventListener("yt-navigate-finish", ytPageLeave); document.addEventListener("spfrequest", ytPageLeave); @@ -1470,4 +1470,4 @@ async function main() { main().catch((e) => { console.error(e); -}); +}); \ No newline at end of file From e70b7d8a35271198decfe369fb2cb012e5ddde6f Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Sat, 29 Jul 2023 17:36:29 +0400 Subject: [PATCH 28/48] Add files via upload --- dist/vot-cloudflare-min.user.js | 2 +- dist/vot-cloudflare.user.js | 3 +-- dist/vot-min.user.js | 2 +- dist/vot.user.js | 3 +-- src/index.js | 3 +-- 5 files changed, 5 insertions(+), 8 deletions(-) diff --git a/dist/vot-cloudflare-min.user.js b/dist/vot-cloudflare-min.user.js index 5b8cd83e..dc9f0a01 100644 --- a/dist/vot-cloudflare-min.user.js +++ b/dist/vot-cloudflare-min.user.js @@ -84,4 +84,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let f=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function b(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),b("#7A7A7D"),V(e);break;case"success":w(e),b("#A36EFF"),V(e);break;default:w("none"),b("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}f in v.Iz||(f="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[f].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[f].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[f].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[f].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[f].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[f].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${f}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,b,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await async function(){const e={};if(e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")){if(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),!e.videoId)return ee.detectedLanguage,ee.responseLanguage;ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage}else window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh");return e}();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[f].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[f].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[f].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[f][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[f].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[f][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[f].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[f].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[f].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[f].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[f].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[f].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[f].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[f].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[f].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[f].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[f].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=f,Object.keys(v.tW).includes(t)?(e.detectedLanguage=t,await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==f&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===f&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[f].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(b=Number(e))}O("none",v.Iz[f].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play()),"abort"===e&&(y.Z.log("lipsync mode is abort"),await oe());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[f].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[f].neededAdditionalExtension:v.Iz[f].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);b=e;const t=x("VOTVideoSlider",e,`${v.Iz[f].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,b);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,b=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===f&&ee.responseLanguage===f)throw Z=!1,v.Iz[f].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[f].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[f].VOTPremiere;if($.duration>14400)throw v.Iz[f].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[f].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[f].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[f].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[f].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[f].translationTakeAboutMinute:v.Iz[f].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[f].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[f].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[f].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[f].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;b=e;const t=x("VOTTranslationSlider",e,`${v.Iz[f].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),b=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[f].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[f].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")&&0!==e.duration?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(e.detectedLanguage=t,await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play()),"abort"===e&&(y.Z.log("lipsync mode is abort"),await oe());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot-cloudflare.user.js b/dist/vot-cloudflare.user.js index 59245c1c..70a584a3 100644 --- a/dist/vot-cloudflare.user.js +++ b/dist/vot-cloudflare.user.js @@ -3075,9 +3075,8 @@ async function src_main() { videoData.responseLanguage = translateToLang; - if (window.location.hostname.includes("youtube.com")) { + if (window.location.hostname.includes("youtube.com") && videoData.duration !== 0) { ytData = await getYTVideoData(); - if (!videoData.videoId) return ytData.detectedLanguage, ytData.responseLanguage; ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); videoData.detectedLanguage = ytData.detectedLanguage; videoData.responseLanguage = ytData.responseLanguage; diff --git a/dist/vot-min.user.js b/dist/vot-min.user.js index f2ff0298..ba770edc 100644 --- a/dist/vot-min.user.js +++ b/dist/vot-min.user.js @@ -83,4 +83,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};if(e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")){if(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),!e.videoId)return te.detectedLanguage,te.responseLanguage;te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage}else window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh");return e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(e.detectedLanguage=t,await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(f.log("lipsync mode is pause"),a.pause()),"stop"===e&&(f.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(f.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(f.log("lipsync mode is playing"),a.play()),"abort"===e&&(f.log("lipsync mode is abort"),await ae());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){const r=`${y[d]}${t}`;await async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")&&0!==e.duration?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(e.detectedLanguage=t,await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(f.log("lipsync mode is pause"),a.pause()),"stop"===e&&(f.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(f.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(f.log("lipsync mode is playing"),a.play()),"abort"===e&&(f.log("lipsync mode is abort"),await ae());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){const r=`${y[d]}${t}`;await async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot.user.js b/dist/vot.user.js index 25136ac7..7b446606 100644 --- a/dist/vot.user.js +++ b/dist/vot.user.js @@ -3004,9 +3004,8 @@ async function src_main() { videoData.responseLanguage = translateToLang; - if (window.location.hostname.includes("youtube.com")) { + if (window.location.hostname.includes("youtube.com") && videoData.duration !== 0) { ytData = await getYTVideoData(); - if (!videoData.videoId) return ytData.detectedLanguage, ytData.responseLanguage; ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); videoData.detectedLanguage = ytData.detectedLanguage; videoData.responseLanguage = ytData.responseLanguage; diff --git a/src/index.js b/src/index.js index 351b69c0..8f544b4e 100644 --- a/src/index.js +++ b/src/index.js @@ -632,9 +632,8 @@ async function main() { videoData.responseLanguage = translateToLang; - if (window.location.hostname.includes("youtube.com")) { + if (window.location.hostname.includes("youtube.com") && videoData.duration !== 0) { ytData = await getYTVideoData(); - if (!videoData.videoId) return ytData.detectedLanguage, ytData.responseLanguage; ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); videoData.detectedLanguage = ytData.detectedLanguage; videoData.responseLanguage = ytData.responseLanguage; From a3542a16d8cf49ccf234c0160307bc945db61214 Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Sun, 30 Jul 2023 03:15:00 +0400 Subject: [PATCH 29/48] =?UTF-8?q?=D0=94=D1=80=D1=83=D0=B3=D0=BE=D0=B9=20?= =?UTF-8?q?=D0=B2=D0=B0=D1=80=D0=B8=D0=B0=D0=BD=D1=82=20=D0=BF=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=D0=B5=D1=80=D0=BA=D0=B8=20=D1=81=D0=BC=D0=B5=D0=BD=D1=8B?= =?UTF-8?q?=20=D1=8F=D0=B7=D1=8B=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Теперь проверка по youtube.com/watch?v= а не youtube.com и проверка на длительность видео --- dist/vot-cloudflare-min.user.js | 2 +- dist/vot-cloudflare.user.js | 2 +- dist/vot-min.user.js | 2 +- dist/vot.user.js | 2 +- src/index.js | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dist/vot-cloudflare-min.user.js b/dist/vot-cloudflare-min.user.js index dc9f0a01..634c91ce 100644 --- a/dist/vot-cloudflare-min.user.js +++ b/dist/vot-cloudflare-min.user.js @@ -84,4 +84,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")&&0!==e.duration?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(e.detectedLanguage=t,await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play()),"abort"===e&&(y.Z.log("lipsync mode is abort"),await oe());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.href.includes("youtube.com/watch?v=")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(e.detectedLanguage=t,await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play()),"abort"===e&&(y.Z.log("lipsync mode is abort"),await oe());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot-cloudflare.user.js b/dist/vot-cloudflare.user.js index 70a584a3..f9247de5 100644 --- a/dist/vot-cloudflare.user.js +++ b/dist/vot-cloudflare.user.js @@ -3075,7 +3075,7 @@ async function src_main() { videoData.responseLanguage = translateToLang; - if (window.location.hostname.includes("youtube.com") && videoData.duration !== 0) { + if (window.location.href.includes("youtube.com/watch?v=")) { ytData = await getYTVideoData(); ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); videoData.detectedLanguage = ytData.detectedLanguage; diff --git a/dist/vot-min.user.js b/dist/vot-min.user.js index ba770edc..e251bc37 100644 --- a/dist/vot-min.user.js +++ b/dist/vot-min.user.js @@ -83,4 +83,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")&&0!==e.duration?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(e.detectedLanguage=t,await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(f.log("lipsync mode is pause"),a.pause()),"stop"===e&&(f.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(f.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(f.log("lipsync mode is playing"),a.play()),"abort"===e&&(f.log("lipsync mode is abort"),await ae());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){const r=`${y[d]}${t}`;await async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.href.includes("youtube.com/watch?v=")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(e.detectedLanguage=t,await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(f.log("lipsync mode is pause"),a.pause()),"stop"===e&&(f.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(f.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(f.log("lipsync mode is playing"),a.play()),"abort"===e&&(f.log("lipsync mode is abort"),await ae());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){const r=`${y[d]}${t}`;await async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot.user.js b/dist/vot.user.js index 7b446606..a2837c4f 100644 --- a/dist/vot.user.js +++ b/dist/vot.user.js @@ -3004,7 +3004,7 @@ async function src_main() { videoData.responseLanguage = translateToLang; - if (window.location.hostname.includes("youtube.com") && videoData.duration !== 0) { + if (window.location.href.includes("youtube.com/watch?v=")) { ytData = await getYTVideoData(); ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); videoData.detectedLanguage = ytData.detectedLanguage; diff --git a/src/index.js b/src/index.js index 8f544b4e..a049a4ff 100644 --- a/src/index.js +++ b/src/index.js @@ -632,7 +632,7 @@ async function main() { videoData.responseLanguage = translateToLang; - if (window.location.hostname.includes("youtube.com") && videoData.duration !== 0) { + if (window.location.href.includes("youtube.com/watch?v=")) { ytData = await getYTVideoData(); ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); videoData.detectedLanguage = ytData.detectedLanguage; From 999b7110bd4a6c6bf2682fd9b1b4fbd3599a94fc Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Sun, 30 Jul 2023 03:29:26 +0400 Subject: [PATCH 30/48] Add files via upload --- dist/vot-cloudflare-min.user.js | 2 +- dist/vot-cloudflare.user.js | 2 +- dist/vot-min.user.js | 2 +- dist/vot.user.js | 2 +- src/index.js | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dist/vot-cloudflare-min.user.js b/dist/vot-cloudflare-min.user.js index 634c91ce..00c6707f 100644 --- a/dist/vot-cloudflare-min.user.js +++ b/dist/vot-cloudflare-min.user.js @@ -84,4 +84,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.href.includes("youtube.com/watch?v=")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(e.detectedLanguage=t,await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play()),"abort"===e&&(y.Z.log("lipsync mode is abort"),await oe());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")&&0!==e.duration||!e.videoId?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(e.detectedLanguage=t,await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play()),"abort"===e&&(y.Z.log("lipsync mode is abort"),await oe());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot-cloudflare.user.js b/dist/vot-cloudflare.user.js index f9247de5..ec043a91 100644 --- a/dist/vot-cloudflare.user.js +++ b/dist/vot-cloudflare.user.js @@ -3075,7 +3075,7 @@ async function src_main() { videoData.responseLanguage = translateToLang; - if (window.location.href.includes("youtube.com/watch?v=")) { + if (window.location.hostname.includes("youtube.com") && videoData.duration !== 0 || !videoData.videoId) { ytData = await getYTVideoData(); ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); videoData.detectedLanguage = ytData.detectedLanguage; diff --git a/dist/vot-min.user.js b/dist/vot-min.user.js index e251bc37..c8e3b53d 100644 --- a/dist/vot-min.user.js +++ b/dist/vot-min.user.js @@ -83,4 +83,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.href.includes("youtube.com/watch?v=")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(e.detectedLanguage=t,await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(f.log("lipsync mode is pause"),a.pause()),"stop"===e&&(f.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(f.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(f.log("lipsync mode is playing"),a.play()),"abort"===e&&(f.log("lipsync mode is abort"),await ae());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){const r=`${y[d]}${t}`;await async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")&&0!==e.duration||!e.videoId?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(e.detectedLanguage=t,await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(f.log("lipsync mode is pause"),a.pause()),"stop"===e&&(f.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(f.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(f.log("lipsync mode is playing"),a.play()),"abort"===e&&(f.log("lipsync mode is abort"),await ae());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){const r=`${y[d]}${t}`;await async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot.user.js b/dist/vot.user.js index a2837c4f..aa5652e3 100644 --- a/dist/vot.user.js +++ b/dist/vot.user.js @@ -3004,7 +3004,7 @@ async function src_main() { videoData.responseLanguage = translateToLang; - if (window.location.href.includes("youtube.com/watch?v=")) { + if (window.location.hostname.includes("youtube.com") && videoData.duration !== 0 || !videoData.videoId) { ytData = await getYTVideoData(); ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); videoData.detectedLanguage = ytData.detectedLanguage; diff --git a/src/index.js b/src/index.js index a049a4ff..fb7cef9c 100644 --- a/src/index.js +++ b/src/index.js @@ -632,7 +632,7 @@ async function main() { videoData.responseLanguage = translateToLang; - if (window.location.href.includes("youtube.com/watch?v=")) { + if (window.location.hostname.includes("youtube.com") && videoData.duration !== 0 || !videoData.videoId) { ytData = await getYTVideoData(); ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); videoData.detectedLanguage = ytData.detectedLanguage; From 38cfa2f6a59d75b9034b5f16e97255f90bfaf716 Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Sun, 30 Jul 2023 05:23:51 +0400 Subject: [PATCH 31/48] Add files via upload --- dist/vot-cloudflare-min.user.js | 2 +- dist/vot-cloudflare.user.js | 11 +++-------- dist/vot-min.user.js | 2 +- dist/vot.user.js | 11 +++-------- src/index.js | 22 ++++++++++------------ 5 files changed, 18 insertions(+), 30 deletions(-) diff --git a/dist/vot-cloudflare-min.user.js b/dist/vot-cloudflare-min.user.js index 00c6707f..264cf8ec 100644 --- a/dist/vot-cloudflare-min.user.js +++ b/dist/vot-cloudflare-min.user.js @@ -84,4 +84,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")&&0!==e.duration||!e.videoId?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(e.detectedLanguage=t,await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play()),"abort"===e&&(y.Z.log("lipsync mode is abort"),await oe());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)||""===e.author?(""!==e.author&&await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play()),"abort"===e&&(y.Z.log("lipsync mode is abort"),await oe());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot-cloudflare.user.js b/dist/vot-cloudflare.user.js index ec043a91..4a4d1811 100644 --- a/dist/vot-cloudflare.user.js +++ b/dist/vot-cloudflare.user.js @@ -2986,16 +2986,11 @@ async function src_main() { async function setDetectedLangauge(data, videolang) { data.detectedLanguage = videolang; data.responseLanguage = lang; - switch (videolang) { - default: - if (!Object.keys(constants/* availableLangs */.tW).includes(videolang)) { + if (!Object.keys(constants/* availableLangs */.tW).includes(videolang) && data.author !== "") { return setDetectedLangauge(data, "en"); - } - - data.detectedLanguage = videolang; } - await setSelectMenuValues(data.detectedLanguage, data.responseLanguage); + if (data.author !== "") await setSelectMenuValues(data.detectedLanguage, data.responseLanguage); return data; } @@ -3075,7 +3070,7 @@ async function src_main() { videoData.responseLanguage = translateToLang; - if (window.location.hostname.includes("youtube.com") && videoData.duration !== 0 || !videoData.videoId) { + if (window.location.hostname.includes("youtube.com")) { ytData = await getYTVideoData(); ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); videoData.detectedLanguage = ytData.detectedLanguage; diff --git a/dist/vot-min.user.js b/dist/vot-min.user.js index c8e3b53d..79ef159c 100644 --- a/dist/vot-min.user.js +++ b/dist/vot-min.user.js @@ -83,4 +83,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")&&0!==e.duration||!e.videoId?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(e.detectedLanguage=t,await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(f.log("lipsync mode is pause"),a.pause()),"stop"===e&&(f.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(f.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(f.log("lipsync mode is playing"),a.play()),"abort"===e&&(f.log("lipsync mode is abort"),await ae());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){const r=`${y[d]}${t}`;await async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)||""===e.author?(""!==e.author&&await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(f.log("lipsync mode is pause"),a.pause()),"stop"===e&&(f.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(f.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(f.log("lipsync mode is playing"),a.play()),"abort"===e&&(f.log("lipsync mode is abort"),await ae());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){const r=`${y[d]}${t}`;await async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot.user.js b/dist/vot.user.js index aa5652e3..b348c4f5 100644 --- a/dist/vot.user.js +++ b/dist/vot.user.js @@ -2915,16 +2915,11 @@ async function src_main() { async function setDetectedLangauge(data, videolang) { data.detectedLanguage = videolang; data.responseLanguage = lang; - switch (videolang) { - default: - if (!Object.keys(availableLangs).includes(videolang)) { + if (!Object.keys(availableLangs).includes(videolang) && data.author !== "") { return setDetectedLangauge(data, "en"); - } - - data.detectedLanguage = videolang; } - await setSelectMenuValues(data.detectedLanguage, data.responseLanguage); + if (data.author !== "") await setSelectMenuValues(data.detectedLanguage, data.responseLanguage); return data; } @@ -3004,7 +2999,7 @@ async function src_main() { videoData.responseLanguage = translateToLang; - if (window.location.hostname.includes("youtube.com") && videoData.duration !== 0 || !videoData.videoId) { + if (window.location.hostname.includes("youtube.com")) { ytData = await getYTVideoData(); ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); videoData.detectedLanguage = ytData.detectedLanguage; diff --git a/src/index.js b/src/index.js index fb7cef9c..fa5543ac 100644 --- a/src/index.js +++ b/src/index.js @@ -543,16 +543,15 @@ async function main() { async function setDetectedLangauge(data, videolang) { data.detectedLanguage = videolang; data.responseLanguage = lang; - switch (videolang) { - default: - if (!Object.keys(availableLangs).includes(videolang)) { - return setDetectedLangauge(data, "en"); - } - - data.detectedLanguage = videolang; + if ( + !Object.keys(availableLangs).includes(videolang) && + data.author !== "" + ) { + return setDetectedLangauge(data, "en"); } - await setSelectMenuValues(data.detectedLanguage, data.responseLanguage); + if (data.author !== "") + await setSelectMenuValues(data.detectedLanguage, data.responseLanguage); return data; } @@ -632,7 +631,7 @@ async function main() { videoData.responseLanguage = translateToLang; - if (window.location.hostname.includes("youtube.com") && videoData.duration !== 0 || !videoData.videoId) { + if (window.location.hostname.includes("youtube.com")) { ytData = await getYTVideoData(); ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); videoData.detectedLanguage = ytData.detectedLanguage; @@ -1038,7 +1037,6 @@ async function main() { ); } - document.addEventListener("click", async (event) => { const block = document.querySelector(".translationBlock"); const menuContainer = document.querySelector(".translationMenuContent"); @@ -1237,7 +1235,7 @@ async function main() { } const ytPageLeave = async () => { document.body.dispatchEvent(new Event("yt-translate-stop")); - }; + }; document.addEventListener("spfdone", ytPageLeave); document.addEventListener("yt-navigate-finish", ytPageLeave); document.addEventListener("spfrequest", ytPageLeave); @@ -1469,4 +1467,4 @@ async function main() { main().catch((e) => { console.error(e); -}); \ No newline at end of file +}); From bfbb0dd14b3b53ece87bbbcafee14613636ff3aa Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Sun, 30 Jul 2023 06:04:43 +0400 Subject: [PATCH 32/48] =?UTF-8?q?=D0=A4=D0=B8=D0=BA=D1=81=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Надеюсь сейчас проблема исчезнет --- dist/vot-cloudflare-min.user.js | 2 +- dist/vot-cloudflare.user.js | 17 ++++++++++------- dist/vot-min.user.js | 2 +- dist/vot.user.js | 17 ++++++++++------- src/index.js | 15 +++++++-------- 5 files changed, 29 insertions(+), 24 deletions(-) diff --git a/dist/vot-cloudflare-min.user.js b/dist/vot-cloudflare-min.user.js index 264cf8ec..833af161 100644 --- a/dist/vot-cloudflare-min.user.js +++ b/dist/vot-cloudflare-min.user.js @@ -84,4 +84,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)||""===e.author?(""!==e.author&&await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play()),"abort"===e&&(y.Z.log("lipsync mode is abort"),await oe());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==ee.author&&(ee=await Y(ee,ee.detectedLanguage)),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),""!==$.author&&await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play()),"abort"===e&&(y.Z.log("lipsync mode is abort"),await oe());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{$.detectedLanguage&&(y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage))};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot-cloudflare.user.js b/dist/vot-cloudflare.user.js index 4a4d1811..b130c1b5 100644 --- a/dist/vot-cloudflare.user.js +++ b/dist/vot-cloudflare.user.js @@ -2747,7 +2747,8 @@ async function src_main() { .querySelector("#VOTTranslateFromLang") .addEventListener("change", async (event) => { debug/* default */.Z.log("[onchange] select from language", event.target.value); - await setDetectedLangauge(videoData, event.target.value); + if (videoData.author !== "") + await setDetectedLangauge(videoData, event.target.value); }); menuOptions @@ -2986,11 +2987,11 @@ async function src_main() { async function setDetectedLangauge(data, videolang) { data.detectedLanguage = videolang; data.responseLanguage = lang; - if (!Object.keys(constants/* availableLangs */.tW).includes(videolang) && data.author !== "") { - return setDetectedLangauge(data, "en"); + if (!Object.keys(constants/* availableLangs */.tW).includes(videolang)) { + return setDetectedLangauge(data, "en"); } - if (data.author !== "") await setSelectMenuValues(data.detectedLanguage, data.responseLanguage); + await setSelectMenuValues(data.detectedLanguage, data.responseLanguage); return data; } @@ -3072,7 +3073,8 @@ async function src_main() { if (window.location.hostname.includes("youtube.com")) { ytData = await getYTVideoData(); - ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); + if (ytData.author !== "") + ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); videoData.detectedLanguage = ytData.detectedLanguage; videoData.responseLanguage = ytData.responseLanguage; } else if ( @@ -3317,6 +3319,7 @@ async function src_main() { } const translateExecutor = async (VIDEO_ID) => { + if (!videoData.detectedLanguage) return; debug/* default */.Z.log("Run videoValidator"); await videoValidator(); debug/* default */.Z.log("Run translateFunc"); @@ -3476,7 +3479,6 @@ async function src_main() { ); } - document.addEventListener("click", async (event) => { const block = document.querySelector(".translationBlock"); const menuContainer = document.querySelector(".translationMenuContent"); @@ -3675,7 +3677,7 @@ async function src_main() { } const ytPageLeave = async () => { document.body.dispatchEvent(new Event("yt-translate-stop")); - }; + }; document.addEventListener("spfdone", ytPageLeave); document.addEventListener("yt-navigate-finish", ytPageLeave); document.addEventListener("spfrequest", ytPageLeave); @@ -3908,6 +3910,7 @@ async function src_main() { src_main().catch((e) => { console.error(e); }); + })(); /******/ })() diff --git a/dist/vot-min.user.js b/dist/vot-min.user.js index 79ef159c..b77686bb 100644 --- a/dist/vot-min.user.js +++ b/dist/vot-min.user.js @@ -83,4 +83,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)||""===e.author?(""!==e.author&&await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(f.log("lipsync mode is pause"),a.pause()),"stop"===e&&(f.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(f.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(f.log("lipsync mode is playing"),a.play()),"abort"===e&&(f.log("lipsync mode is abort"),await ae());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){const r=`${y[d]}${t}`;await async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==te.author&&(te=await G(te,te.detectedLanguage)),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),""!==_.author&&await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(f.log("lipsync mode is pause"),a.pause()),"stop"===e&&(f.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(f.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(f.log("lipsync mode is playing"),a.play()),"abort"===e&&(f.log("lipsync mode is abort"),await ae());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{_.detectedLanguage&&(f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage))};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){const r=`${y[d]}${t}`;await async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot.user.js b/dist/vot.user.js index b348c4f5..9e8a6c33 100644 --- a/dist/vot.user.js +++ b/dist/vot.user.js @@ -2695,7 +2695,8 @@ async function src_main() { .querySelector("#VOTTranslateFromLang") .addEventListener("change", async (event) => { utils_debug.log("[onchange] select from language", event.target.value); - await setDetectedLangauge(videoData, event.target.value); + if (videoData.author !== "") + await setDetectedLangauge(videoData, event.target.value); }); menuOptions @@ -2915,11 +2916,11 @@ async function src_main() { async function setDetectedLangauge(data, videolang) { data.detectedLanguage = videolang; data.responseLanguage = lang; - if (!Object.keys(availableLangs).includes(videolang) && data.author !== "") { - return setDetectedLangauge(data, "en"); + if (!Object.keys(availableLangs).includes(videolang)) { + return setDetectedLangauge(data, "en"); } - if (data.author !== "") await setSelectMenuValues(data.detectedLanguage, data.responseLanguage); + await setSelectMenuValues(data.detectedLanguage, data.responseLanguage); return data; } @@ -3001,7 +3002,8 @@ async function src_main() { if (window.location.hostname.includes("youtube.com")) { ytData = await getYTVideoData(); - ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); + if (ytData.author !== "") + ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); videoData.detectedLanguage = ytData.detectedLanguage; videoData.responseLanguage = ytData.responseLanguage; } else if ( @@ -3246,6 +3248,7 @@ async function src_main() { } const translateExecutor = async (VIDEO_ID) => { + if (!videoData.detectedLanguage) return; utils_debug.log("Run videoValidator"); await videoValidator(); utils_debug.log("Run translateFunc"); @@ -3395,7 +3398,6 @@ async function src_main() { ); } - document.addEventListener("click", async (event) => { const block = document.querySelector(".translationBlock"); const menuContainer = document.querySelector(".translationMenuContent"); @@ -3594,7 +3596,7 @@ async function src_main() { } const ytPageLeave = async () => { document.body.dispatchEvent(new Event("yt-translate-stop")); - }; + }; document.addEventListener("spfdone", ytPageLeave); document.addEventListener("yt-navigate-finish", ytPageLeave); document.addEventListener("spfrequest", ytPageLeave); @@ -3827,6 +3829,7 @@ async function src_main() { src_main().catch((e) => { console.error(e); }); + })(); /******/ })() diff --git a/src/index.js b/src/index.js index fa5543ac..052ccf16 100644 --- a/src/index.js +++ b/src/index.js @@ -304,7 +304,8 @@ async function main() { .querySelector("#VOTTranslateFromLang") .addEventListener("change", async (event) => { debug.log("[onchange] select from language", event.target.value); - await setDetectedLangauge(videoData, event.target.value); + if (videoData.author !== "") + await setDetectedLangauge(videoData, event.target.value); }); menuOptions @@ -543,15 +544,11 @@ async function main() { async function setDetectedLangauge(data, videolang) { data.detectedLanguage = videolang; data.responseLanguage = lang; - if ( - !Object.keys(availableLangs).includes(videolang) && - data.author !== "" - ) { + if (!Object.keys(availableLangs).includes(videolang)) { return setDetectedLangauge(data, "en"); } - if (data.author !== "") - await setSelectMenuValues(data.detectedLanguage, data.responseLanguage); + await setSelectMenuValues(data.detectedLanguage, data.responseLanguage); return data; } @@ -633,7 +630,8 @@ async function main() { if (window.location.hostname.includes("youtube.com")) { ytData = await getYTVideoData(); - ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); + if (ytData.author !== "") + ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); videoData.detectedLanguage = ytData.detectedLanguage; videoData.responseLanguage = ytData.responseLanguage; } else if ( @@ -878,6 +876,7 @@ async function main() { } const translateExecutor = async (VIDEO_ID) => { + if (!videoData.detectedLanguage) return; debug.log("Run videoValidator"); await videoValidator(); debug.log("Run translateFunc"); From 0435da9e42b86dbba4345695d52d72c5aa708aa4 Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Sun, 30 Jul 2023 06:11:47 +0400 Subject: [PATCH 33/48] Add files via upload --- dist/vot-cloudflare-min.user.js | 2 +- dist/vot-cloudflare.user.js | 2 +- dist/vot-min.user.js | 2 +- dist/vot.user.js | 2 +- src/index.js | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dist/vot-cloudflare-min.user.js b/dist/vot-cloudflare-min.user.js index 833af161..be93b04d 100644 --- a/dist/vot-cloudflare-min.user.js +++ b/dist/vot-cloudflare-min.user.js @@ -84,4 +84,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==ee.author&&(ee=await Y(ee,ee.detectedLanguage)),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),""!==$.author&&await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play()),"abort"===e&&(y.Z.log("lipsync mode is abort"),await oe());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{$.detectedLanguage&&(y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage))};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")&&0!==e.duration?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==ee.author&&(ee=await Y(ee,ee.detectedLanguage)),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),""!==$.author&&await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play()),"abort"===e&&(y.Z.log("lipsync mode is abort"),await oe());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{$.detectedLanguage&&(y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage))};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot-cloudflare.user.js b/dist/vot-cloudflare.user.js index b130c1b5..50dc0deb 100644 --- a/dist/vot-cloudflare.user.js +++ b/dist/vot-cloudflare.user.js @@ -3071,7 +3071,7 @@ async function src_main() { videoData.responseLanguage = translateToLang; - if (window.location.hostname.includes("youtube.com")) { + if (window.location.hostname.includes("youtube.com") && videoData.duration !== 0) { ytData = await getYTVideoData(); if (ytData.author !== "") ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); diff --git a/dist/vot-min.user.js b/dist/vot-min.user.js index b77686bb..ecf9d450 100644 --- a/dist/vot-min.user.js +++ b/dist/vot-min.user.js @@ -83,4 +83,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==te.author&&(te=await G(te,te.detectedLanguage)),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),""!==_.author&&await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(f.log("lipsync mode is pause"),a.pause()),"stop"===e&&(f.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(f.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(f.log("lipsync mode is playing"),a.play()),"abort"===e&&(f.log("lipsync mode is abort"),await ae());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{_.detectedLanguage&&(f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage))};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){const r=`${y[d]}${t}`;await async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")&&0!==e.duration?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==te.author&&(te=await G(te,te.detectedLanguage)),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),""!==_.author&&await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(f.log("lipsync mode is pause"),a.pause()),"stop"===e&&(f.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(f.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(f.log("lipsync mode is playing"),a.play()),"abort"===e&&(f.log("lipsync mode is abort"),await ae());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{_.detectedLanguage&&(f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage))};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){const r=`${y[d]}${t}`;await async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot.user.js b/dist/vot.user.js index 9e8a6c33..375c6beb 100644 --- a/dist/vot.user.js +++ b/dist/vot.user.js @@ -3000,7 +3000,7 @@ async function src_main() { videoData.responseLanguage = translateToLang; - if (window.location.hostname.includes("youtube.com")) { + if (window.location.hostname.includes("youtube.com") && videoData.duration !== 0) { ytData = await getYTVideoData(); if (ytData.author !== "") ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); diff --git a/src/index.js b/src/index.js index 052ccf16..679d0448 100644 --- a/src/index.js +++ b/src/index.js @@ -628,7 +628,7 @@ async function main() { videoData.responseLanguage = translateToLang; - if (window.location.hostname.includes("youtube.com")) { + if (window.location.hostname.includes("youtube.com") && videoData.duration !== 0) { ytData = await getYTVideoData(); if (ytData.author !== "") ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); From 82bed1065fa0fee99fc0a8f429d4e8848931d022 Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Mon, 31 Jul 2023 14:17:11 +0400 Subject: [PATCH 34/48] Add files via upload --- dist/vot-cloudflare-min.user.js | 2 +- dist/vot-cloudflare.user.js | 10 ++++++---- dist/vot-min.user.js | 2 +- dist/vot.user.js | 10 ++++++---- src/index.js | 10 ++++++---- 5 files changed, 20 insertions(+), 14 deletions(-) diff --git a/dist/vot-cloudflare-min.user.js b/dist/vot-cloudflare-min.user.js index be93b04d..b2abd32b 100644 --- a/dist/vot-cloudflare-min.user.js +++ b/dist/vot-cloudflare-min.user.js @@ -84,4 +84,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")&&0!==e.duration?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==ee.author&&(ee=await Y(ee,ee.detectedLanguage)),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),""!==$.author&&await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play()),"abort"===e&&(y.Z.log("lipsync mode is abort"),await oe());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{$.detectedLanguage&&(y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage))};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")&&0!==e.duration?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==ee.author&&(ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),0!==$.duration&&await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play()),"abort"===e&&(y.Z.log("lipsync mode is abort"),await oe());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{$.detectedLanguage&&(y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage))};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot-cloudflare.user.js b/dist/vot-cloudflare.user.js index 50dc0deb..568a2de9 100644 --- a/dist/vot-cloudflare.user.js +++ b/dist/vot-cloudflare.user.js @@ -2747,8 +2747,9 @@ async function src_main() { .querySelector("#VOTTranslateFromLang") .addEventListener("change", async (event) => { debug/* default */.Z.log("[onchange] select from language", event.target.value); - if (videoData.author !== "") + if (videoData.duration !== 0) { await setDetectedLangauge(videoData, event.target.value); + } }); menuOptions @@ -3073,10 +3074,11 @@ async function src_main() { if (window.location.hostname.includes("youtube.com") && videoData.duration !== 0) { ytData = await getYTVideoData(); - if (ytData.author !== "") + if (ytData.author !== "") { ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); - videoData.detectedLanguage = ytData.detectedLanguage; - videoData.responseLanguage = ytData.responseLanguage; + videoData.detectedLanguage = ytData.detectedLanguage; + videoData.responseLanguage = ytData.responseLanguage; + } } else if ( window.location.hostname.includes("rutube") || window.location.hostname.includes("my.mail.ru") diff --git a/dist/vot-min.user.js b/dist/vot-min.user.js index ecf9d450..39973616 100644 --- a/dist/vot-min.user.js +++ b/dist/vot-min.user.js @@ -83,4 +83,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")&&0!==e.duration?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==te.author&&(te=await G(te,te.detectedLanguage)),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),""!==_.author&&await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(f.log("lipsync mode is pause"),a.pause()),"stop"===e&&(f.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(f.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(f.log("lipsync mode is playing"),a.play()),"abort"===e&&(f.log("lipsync mode is abort"),await ae());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{_.detectedLanguage&&(f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage))};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){const r=`${y[d]}${t}`;await async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")&&0!==e.duration?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==te.author&&(te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),0!==_.duration&&await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(f.log("lipsync mode is pause"),a.pause()),"stop"===e&&(f.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(f.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(f.log("lipsync mode is playing"),a.play()),"abort"===e&&(f.log("lipsync mode is abort"),await ae());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{_.detectedLanguage&&(f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage))};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){const r=`${y[d]}${t}`;await async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot.user.js b/dist/vot.user.js index 375c6beb..45b63ed2 100644 --- a/dist/vot.user.js +++ b/dist/vot.user.js @@ -2695,8 +2695,9 @@ async function src_main() { .querySelector("#VOTTranslateFromLang") .addEventListener("change", async (event) => { utils_debug.log("[onchange] select from language", event.target.value); - if (videoData.author !== "") + if (videoData.duration !== 0) { await setDetectedLangauge(videoData, event.target.value); + } }); menuOptions @@ -3002,10 +3003,11 @@ async function src_main() { if (window.location.hostname.includes("youtube.com") && videoData.duration !== 0) { ytData = await getYTVideoData(); - if (ytData.author !== "") + if (ytData.author !== "") { ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); - videoData.detectedLanguage = ytData.detectedLanguage; - videoData.responseLanguage = ytData.responseLanguage; + videoData.detectedLanguage = ytData.detectedLanguage; + videoData.responseLanguage = ytData.responseLanguage; + } } else if ( window.location.hostname.includes("rutube") || window.location.hostname.includes("my.mail.ru") diff --git a/src/index.js b/src/index.js index 679d0448..e1ccdd72 100644 --- a/src/index.js +++ b/src/index.js @@ -304,8 +304,9 @@ async function main() { .querySelector("#VOTTranslateFromLang") .addEventListener("change", async (event) => { debug.log("[onchange] select from language", event.target.value); - if (videoData.author !== "") + if (videoData.duration !== 0) { await setDetectedLangauge(videoData, event.target.value); + } }); menuOptions @@ -630,10 +631,11 @@ async function main() { if (window.location.hostname.includes("youtube.com") && videoData.duration !== 0) { ytData = await getYTVideoData(); - if (ytData.author !== "") + if (ytData.author !== "") { ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); - videoData.detectedLanguage = ytData.detectedLanguage; - videoData.responseLanguage = ytData.responseLanguage; + videoData.detectedLanguage = ytData.detectedLanguage; + videoData.responseLanguage = ytData.responseLanguage; + } } else if ( window.location.hostname.includes("rutube") || window.location.hostname.includes("my.mail.ru") From 7fccbee197a548ff118204c8042b6a62a8bf689f Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Mon, 31 Jul 2023 16:34:18 +0400 Subject: [PATCH 35/48] videoData --- dist/vot-cloudflare-min.user.js | 2 +- dist/vot-cloudflare.user.js | 6 +++--- dist/vot-min.user.js | 2 +- dist/vot.user.js | 6 +++--- src/index.js | 6 +++--- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/dist/vot-cloudflare-min.user.js b/dist/vot-cloudflare-min.user.js index b2abd32b..d8f09e5e 100644 --- a/dist/vot-cloudflare-min.user.js +++ b/dist/vot-cloudflare-min.user.js @@ -84,4 +84,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")&&0!==e.duration?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==ee.author&&(ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),0!==$.duration&&await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play()),"abort"===e&&(y.Z.log("lipsync mode is abort"),await oe());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{$.detectedLanguage&&(y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage))};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $="";console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),0!==$.duration&&await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play()),"abort"===e&&(y.Z.log("lipsync mode is abort"),await oe());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{$=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")&&0!==e.duration?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==ee.author&&(ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}(),y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,await e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot-cloudflare.user.js b/dist/vot-cloudflare.user.js index 568a2de9..c58a5105 100644 --- a/dist/vot-cloudflare.user.js +++ b/dist/vot-cloudflare.user.js @@ -2593,7 +2593,7 @@ async function src_main() { translationPanding = true; - requestVideoTranslation( + await requestVideoTranslation( url, unknown1, requestLang, @@ -2669,7 +2669,7 @@ async function src_main() { debug/* default */.Z.log("video", video); - let videoData = await getVideoData(); + let videoData = ""; console.log("VOT Video Data: ", videoData); const container = @@ -3321,7 +3321,7 @@ async function src_main() { } const translateExecutor = async (VIDEO_ID) => { - if (!videoData.detectedLanguage) return; + videoData = await getVideoData() debug/* default */.Z.log("Run videoValidator"); await videoValidator(); debug/* default */.Z.log("Run translateFunc"); diff --git a/dist/vot-min.user.js b/dist/vot-min.user.js index 39973616..6b70b776 100644 --- a/dist/vot-min.user.js +++ b/dist/vot-min.user.js @@ -83,4 +83,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")&&0!==e.duration?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==te.author&&(te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}();console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),0!==_.duration&&await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(f.log("lipsync mode is pause"),a.pause()),"stop"===e&&(f.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(f.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(f.log("lipsync mode is playing"),a.play()),"abort"===e&&(f.log("lipsync mode is abort"),await ae());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{_.detectedLanguage&&(f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage))};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){const r=`${y[d]}${t}`;await async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _="";console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),0!==_.duration&&await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(f.log("lipsync mode is pause"),a.pause()),"stop"===e&&(f.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(f.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(f.log("lipsync mode is playing"),a.play()),"abort"===e&&(f.log("lipsync mode is abort"),await ae());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{_=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")&&0!==e.duration?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==te.author&&(te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}(),f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){const r=`${y[d]}${t}`;await async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),await e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot.user.js b/dist/vot.user.js index 45b63ed2..9aafad01 100644 --- a/dist/vot.user.js +++ b/dist/vot.user.js @@ -2541,7 +2541,7 @@ async function src_main() { translationPanding = true; - requestVideoTranslation( + await requestVideoTranslation( url, unknown1, requestLang, @@ -2617,7 +2617,7 @@ async function src_main() { utils_debug.log("video", video); - let videoData = await getVideoData(); + let videoData = ""; console.log("VOT Video Data: ", videoData); const container = @@ -3250,7 +3250,7 @@ async function src_main() { } const translateExecutor = async (VIDEO_ID) => { - if (!videoData.detectedLanguage) return; + videoData = await getVideoData() utils_debug.log("Run videoValidator"); await videoValidator(); utils_debug.log("Run translateFunc"); diff --git a/src/index.js b/src/index.js index e1ccdd72..446df27b 100644 --- a/src/index.js +++ b/src/index.js @@ -150,7 +150,7 @@ async function main() { translationPanding = true; - requestVideoTranslation( + await requestVideoTranslation( url, unknown1, requestLang, @@ -226,7 +226,7 @@ async function main() { debug.log("video", video); - let videoData = await getVideoData(); + let videoData = ""; console.log("VOT Video Data: ", videoData); const container = @@ -878,7 +878,7 @@ async function main() { } const translateExecutor = async (VIDEO_ID) => { - if (!videoData.detectedLanguage) return; + videoData = await getVideoData() debug.log("Run videoValidator"); await videoValidator(); debug.log("Run translateFunc"); From d12e4f94c22514bb2bd09369c1e31d3ae9c778b5 Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Mon, 31 Jul 2023 16:51:39 +0400 Subject: [PATCH 36/48] Add files via upload --- dist/vot-cloudflare-min.user.js | 2 +- dist/vot-cloudflare.user.js | 2 +- dist/vot-min.user.js | 2 +- dist/vot.user.js | 2 +- src/index.js | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dist/vot-cloudflare-min.user.js b/dist/vot-cloudflare-min.user.js index d8f09e5e..6ca1edb1 100644 --- a/dist/vot-cloudflare-min.user.js +++ b/dist/vot-cloudflare-min.user.js @@ -84,4 +84,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $="";console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),0!==$.duration&&await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play()),"abort"===e&&(y.Z.log("lipsync mode is abort"),await oe());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{$=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")&&0!==e.duration?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==ee.author&&(ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}(),y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,await e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $="";console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),0!==$.duration&&await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play()),"abort"===e&&(y.Z.log("lipsync mode is abort"),await oe());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{$.detectedLanguage||($=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")&&0!==e.duration?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==ee.author&&(ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}()),y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,await e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot-cloudflare.user.js b/dist/vot-cloudflare.user.js index c58a5105..7d439393 100644 --- a/dist/vot-cloudflare.user.js +++ b/dist/vot-cloudflare.user.js @@ -3321,7 +3321,7 @@ async function src_main() { } const translateExecutor = async (VIDEO_ID) => { - videoData = await getVideoData() + if (!videoData.detectedLanguage) videoData = await getVideoData() debug/* default */.Z.log("Run videoValidator"); await videoValidator(); debug/* default */.Z.log("Run translateFunc"); diff --git a/dist/vot-min.user.js b/dist/vot-min.user.js index 6b70b776..494dbc39 100644 --- a/dist/vot-min.user.js +++ b/dist/vot-min.user.js @@ -83,4 +83,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _="";console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),0!==_.duration&&await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(f.log("lipsync mode is pause"),a.pause()),"stop"===e&&(f.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(f.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(f.log("lipsync mode is playing"),a.play()),"abort"===e&&(f.log("lipsync mode is abort"),await ae());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{_=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")&&0!==e.duration?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==te.author&&(te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}(),f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){const r=`${y[d]}${t}`;await async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),await e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _="";console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),0!==_.duration&&await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(f.log("lipsync mode is pause"),a.pause()),"stop"===e&&(f.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(f.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(f.log("lipsync mode is playing"),a.play()),"abort"===e&&(f.log("lipsync mode is abort"),await ae());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{_.detectedLanguage||(_=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")&&0!==e.duration?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==te.author&&(te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}()),f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){const r=`${y[d]}${t}`;await async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),await e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot.user.js b/dist/vot.user.js index 9aafad01..4cb2ae97 100644 --- a/dist/vot.user.js +++ b/dist/vot.user.js @@ -3250,7 +3250,7 @@ async function src_main() { } const translateExecutor = async (VIDEO_ID) => { - videoData = await getVideoData() + if (!videoData.detectedLanguage) videoData = await getVideoData() utils_debug.log("Run videoValidator"); await videoValidator(); utils_debug.log("Run translateFunc"); diff --git a/src/index.js b/src/index.js index 446df27b..39b0b32d 100644 --- a/src/index.js +++ b/src/index.js @@ -878,7 +878,7 @@ async function main() { } const translateExecutor = async (VIDEO_ID) => { - videoData = await getVideoData() + if (!videoData.detectedLanguage) videoData = await getVideoData() debug.log("Run videoValidator"); await videoValidator(); debug.log("Run translateFunc"); From 3f8725dbc615cd1325c049db4b8ef3d736fb3fbc Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Wed, 2 Aug 2023 06:05:14 +0400 Subject: [PATCH 37/48] Add files via upload --- dist/vot-cloudflare-min.user.js | 2 +- dist/vot-cloudflare.user.js | 15 +++++++++------ dist/vot-min.user.js | 2 +- dist/vot.user.js | 15 +++++++++------ src/index.js | 15 +++++++++------ 5 files changed, 29 insertions(+), 20 deletions(-) diff --git a/dist/vot-cloudflare-min.user.js b/dist/vot-cloudflare-min.user.js index 6ca1edb1..83f61ec8 100644 --- a/dist/vot-cloudflare-min.user.js +++ b/dist/vot-cloudflare-min.user.js @@ -84,4 +84,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0;y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);let $="";console.log("VOT Video Data: ",$);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),0!==$.duration&&await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play()),"abort"===e&&(y.Z.log("lipsync mode is abort"),await oe());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{$.detectedLanguage||($=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")&&0!==e.duration?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==ee.author&&(ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}()),y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw Z=!1,v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,await e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0,$="";y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),0===$.duration&&null===$||await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play()),"abort"===e&&(y.Z.log("lipsync mode is abort"),await oe());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{$.detectedLanguage||($=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")&&0!==e.duration||null!==e?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==ee.author&&(ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}()),console.log("VOT Video Data: ",$),y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,await e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),window.addEventListener("popstate",(async function(){await oe(),$="",y.Z.log("popstate triggered")})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot-cloudflare.user.js b/dist/vot-cloudflare.user.js index 7d439393..c4de9d44 100644 --- a/dist/vot-cloudflare.user.js +++ b/dist/vot-cloudflare.user.js @@ -2657,6 +2657,7 @@ async function src_main() { let dbAudioProxy; // cf version only let firstPlay = true; let isDBInited; + let videoData = ""; debug/* default */.Z.log("videoContainer", videoContainer); @@ -2669,9 +2670,6 @@ async function src_main() { debug/* default */.Z.log("video", video); - let videoData = ""; - console.log("VOT Video Data: ", videoData); - const container = siteHostname === "pornhub" && window.location.pathname.includes("view_video.php") @@ -2747,7 +2745,7 @@ async function src_main() { .querySelector("#VOTTranslateFromLang") .addEventListener("change", async (event) => { debug/* default */.Z.log("[onchange] select from language", event.target.value); - if (videoData.duration !== 0) { + if (videoData.duration !== 0 || videoData !== null) { await setDetectedLangauge(videoData, event.target.value); } }); @@ -3072,7 +3070,7 @@ async function src_main() { videoData.responseLanguage = translateToLang; - if (window.location.hostname.includes("youtube.com") && videoData.duration !== 0) { + if (window.location.hostname.includes("youtube.com") && videoData.duration !== 0 || videoData !== null ) { ytData = await getYTVideoData(); if (ytData.author !== "") { ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); @@ -3302,7 +3300,6 @@ async function src_main() { ytData.detectedLanguage === lang && ytData.responseLanguage === lang ) { - firstPlay = false; throw constants/* translations */.Iz[lang].VOTDisableFromYourLang; } @@ -3322,6 +3319,7 @@ async function src_main() { const translateExecutor = async (VIDEO_ID) => { if (!videoData.detectedLanguage) videoData = await getVideoData() + console.log("VOT Video Data: ", videoData); debug/* default */.Z.log("Run videoValidator"); await videoValidator(); debug/* default */.Z.log("Run translateFunc"); @@ -3554,6 +3552,11 @@ async function src_main() { document.addEventListener("touchend", (event) => changeOpacityOnEvent(event, timer, opacityRatio) ); + window.addEventListener("popstate", async function () { + await stopTranslation() + videoData = "" + debug/* default */.Z.log("popstate triggered") + }); document .querySelector(".translationBtn") diff --git a/dist/vot-min.user.js b/dist/vot-min.user.js index 494dbc39..f4ace28f 100644 --- a/dist/vot-min.user.js +++ b/dist/vot-min.user.js @@ -83,4 +83,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0;f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);let _="";console.log("VOT Video Data: ",_);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),0!==_.duration&&await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(f.log("lipsync mode is pause"),a.pause()),"stop"===e&&(f.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(f.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(f.log("lipsync mode is playing"),a.play()),"abort"===e&&(f.log("lipsync mode is abort"),await ae());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{_.detectedLanguage||(_=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")&&0!==e.duration?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==te.author&&(te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}()),f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw z=!1,b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){const r=`${y[d]}${t}`;await async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),await e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0,_="";f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),0===_.duration&&null===_||await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(f.log("lipsync mode is pause"),a.pause()),"stop"===e&&(f.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(f.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(f.log("lipsync mode is playing"),a.play()),"abort"===e&&(f.log("lipsync mode is abort"),await ae());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{_.detectedLanguage||(_=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")&&0!==e.duration||null!==e?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==te.author&&(te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}()),console.log("VOT Video Data: ",_),f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){const r=`${y[d]}${t}`;await async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),await e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),window.addEventListener("popstate",(async function(){await ae(),_="",f.log("popstate triggered")})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot.user.js b/dist/vot.user.js index 4cb2ae97..2fe8ba3a 100644 --- a/dist/vot.user.js +++ b/dist/vot.user.js @@ -2605,6 +2605,7 @@ async function src_main() { let dbAudioProxy; // cf version only let firstPlay = true; let isDBInited; + let videoData = ""; utils_debug.log("videoContainer", videoContainer); @@ -2617,9 +2618,6 @@ async function src_main() { utils_debug.log("video", video); - let videoData = ""; - console.log("VOT Video Data: ", videoData); - const container = siteHostname === "pornhub" && window.location.pathname.includes("view_video.php") @@ -2695,7 +2693,7 @@ async function src_main() { .querySelector("#VOTTranslateFromLang") .addEventListener("change", async (event) => { utils_debug.log("[onchange] select from language", event.target.value); - if (videoData.duration !== 0) { + if (videoData.duration !== 0 || videoData !== null) { await setDetectedLangauge(videoData, event.target.value); } }); @@ -3001,7 +2999,7 @@ async function src_main() { videoData.responseLanguage = translateToLang; - if (window.location.hostname.includes("youtube.com") && videoData.duration !== 0) { + if (window.location.hostname.includes("youtube.com") && videoData.duration !== 0 || videoData !== null ) { ytData = await getYTVideoData(); if (ytData.author !== "") { ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); @@ -3231,7 +3229,6 @@ async function src_main() { ytData.detectedLanguage === lang && ytData.responseLanguage === lang ) { - firstPlay = false; throw translations[lang].VOTDisableFromYourLang; } @@ -3251,6 +3248,7 @@ async function src_main() { const translateExecutor = async (VIDEO_ID) => { if (!videoData.detectedLanguage) videoData = await getVideoData() + console.log("VOT Video Data: ", videoData); utils_debug.log("Run videoValidator"); await videoValidator(); utils_debug.log("Run translateFunc"); @@ -3473,6 +3471,11 @@ async function src_main() { document.addEventListener("touchend", (event) => changeOpacityOnEvent(event, timer, opacityRatio) ); + window.addEventListener("popstate", async function () { + await stopTranslation() + videoData = "" + utils_debug.log("popstate triggered") + }); document .querySelector(".translationBtn") diff --git a/src/index.js b/src/index.js index 39b0b32d..ea0ef096 100644 --- a/src/index.js +++ b/src/index.js @@ -214,6 +214,7 @@ async function main() { let dbAudioProxy; // cf version only let firstPlay = true; let isDBInited; + let videoData = ""; debug.log("videoContainer", videoContainer); @@ -226,9 +227,6 @@ async function main() { debug.log("video", video); - let videoData = ""; - console.log("VOT Video Data: ", videoData); - const container = siteHostname === "pornhub" && window.location.pathname.includes("view_video.php") @@ -304,7 +302,7 @@ async function main() { .querySelector("#VOTTranslateFromLang") .addEventListener("change", async (event) => { debug.log("[onchange] select from language", event.target.value); - if (videoData.duration !== 0) { + if (videoData.duration !== 0 || videoData !== null) { await setDetectedLangauge(videoData, event.target.value); } }); @@ -629,7 +627,7 @@ async function main() { videoData.responseLanguage = translateToLang; - if (window.location.hostname.includes("youtube.com") && videoData.duration !== 0) { + if (window.location.hostname.includes("youtube.com") && videoData.duration !== 0 || videoData !== null ) { ytData = await getYTVideoData(); if (ytData.author !== "") { ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); @@ -859,7 +857,6 @@ async function main() { ytData.detectedLanguage === lang && ytData.responseLanguage === lang ) { - firstPlay = false; throw translations[lang].VOTDisableFromYourLang; } @@ -879,6 +876,7 @@ async function main() { const translateExecutor = async (VIDEO_ID) => { if (!videoData.detectedLanguage) videoData = await getVideoData() + console.log("VOT Video Data: ", videoData); debug.log("Run videoValidator"); await videoValidator(); debug.log("Run translateFunc"); @@ -1111,6 +1109,11 @@ async function main() { document.addEventListener("touchend", (event) => changeOpacityOnEvent(event, timer, opacityRatio) ); + window.addEventListener("popstate", async function () { + await stopTranslation() + videoData = "" + debug.log("popstate triggered") + }); document .querySelector(".translationBtn") From 2c8fa3237de70c6db89908b6cdd7d3076d9b552e Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Wed, 2 Aug 2023 06:31:43 +0400 Subject: [PATCH 38/48] Add files via upload --- dist/vot-cloudflare-min.user.js | 2 +- dist/vot-cloudflare.user.js | 19 ++++++++++--------- dist/vot-min.user.js | 2 +- dist/vot.user.js | 19 ++++++++++--------- src/index.js | 19 ++++++++++--------- 5 files changed, 32 insertions(+), 29 deletions(-) diff --git a/dist/vot-cloudflare-min.user.js b/dist/vot-cloudflare-min.user.js index 83f61ec8..b7bf1d96 100644 --- a/dist/vot-cloudflare-min.user.js +++ b/dist/vot-cloudflare-min.user.js @@ -84,4 +84,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],z=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],A=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,A)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...z];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,z,A,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0,$="";y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),0===$.duration&&null===$||await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,z=e.dontTranslateYourLang,q=e.audioProxy,A=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",z,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),z=t,y.Z.log("dontTranslateYourLang value changed. New value: ",z)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",A,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),A=t,y.Z.log("syncVolume value changed. New value: ",A)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===A&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play()),"abort"===e&&(y.Z.log("lipsync mode is abort"),await oe());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==A)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{$.detectedLanguage||($=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")&&0!==e.duration||null!==e?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==ee.author&&(ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}()),console.log("VOT Video Data: ",$),y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===z&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,await e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===A&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),window.addEventListener("popstate",(async function(){await oe(),$="",y.Z.log("popstate triggered")})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(z.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let f=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function b(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),b("#7A7A7D"),V(e);break;case"success":w(e),b("#A36EFF"),V(e);break;default:w("none"),b("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}f in v.Iz||(f="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],A=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],z=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,z)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[f].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[f].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[f].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[f].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[f].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[f].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...A];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${f}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,b,V,w,L,F,M,A,z,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0,$="";y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[f].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[f].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[f].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[f][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[f].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[f][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[f].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[f].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[f].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[f].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,A=e.dontTranslateYourLang,q=e.audioProxy,z=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[f].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[f].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",A,v.Iz[f].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),A=t,y.Z.log("dontTranslateYourLang value changed. New value: ",A)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[f].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[f].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",z,v.Iz[f].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),z=t,y.Z.log("syncVolume value changed. New value: ",z)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[f].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=f,Object.keys(v.tW).includes(t)?(await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==f&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===f&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){$="",o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[f].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===z&&(b=Number(e))}O("none",v.Iz[f].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[f].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[f].neededAdditionalExtension:v.Iz[f].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);b=e;const t=x("VOTVideoSlider",e,`${v.Iz[f].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==z)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,b);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,b=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{$.detectedLanguage||($=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==ee.author&&(ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}()),console.log("VOT Video Data: ",$),y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===A&&ee.detectedLanguage===f&&ee.responseLanguage===f)throw v.Iz[f].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[f].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[f].VOTPremiere;if($.duration>14400)throw v.Iz[f].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,await e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[f].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[f].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[f].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[f].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[f].translationTakeAboutMinute:v.Iz[f].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[f].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[f].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[f].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[f].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;b=e;const t=x("VOTTranslationSlider",e,`${v.Iz[f].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===z&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),b=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),window.addEventListener("popstate",(async function(){await oe(),y.Z.log("popstate triggered")})),document.querySelectorAll("video").forEach((e=>{e.addEventListener("abort",(async()=>{y.Z.log("lipsync mode is abort"),$="",await oe()}))})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[f].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[f].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(A.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot-cloudflare.user.js b/dist/vot-cloudflare.user.js index c4de9d44..39667ad9 100644 --- a/dist/vot-cloudflare.user.js +++ b/dist/vot-cloudflare.user.js @@ -2745,9 +2745,7 @@ async function src_main() { .querySelector("#VOTTranslateFromLang") .addEventListener("change", async (event) => { debug/* default */.Z.log("[onchange] select from language", event.target.value); - if (videoData.duration !== 0 || videoData !== null) { await setDetectedLangauge(videoData, event.target.value); - } }); menuOptions @@ -3021,6 +3019,7 @@ async function src_main() { async function stopTraslate() { // Default actions on stop translate + videoData = "" audio.pause(); video.removeEventListener(".translate", stopTraslate, false); await deleteAudioSrc(); @@ -3070,7 +3069,7 @@ async function src_main() { videoData.responseLanguage = translateToLang; - if (window.location.hostname.includes("youtube.com") && videoData.duration !== 0 || videoData !== null ) { + if (window.location.hostname.includes("youtube.com")) { ytData = await getYTVideoData(); if (ytData.author !== "") { ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); @@ -3142,10 +3141,6 @@ async function src_main() { debug/* default */.Z.log("lipsync mode is playing"); audio.play(); } - if (mode === "abort") { - debug/* default */.Z.log("lipsync mode is abort"); - await stopTranslation(); - } }; async function addVideoSlider() { @@ -3452,7 +3447,6 @@ async function src_main() { "playing", "ratechange", "play", - "abort", "waiting", "pause", ]; @@ -3554,9 +3548,16 @@ async function src_main() { ); window.addEventListener("popstate", async function () { await stopTranslation() - videoData = "" debug/* default */.Z.log("popstate triggered") }); + document.querySelectorAll("video").forEach(video => { + video.addEventListener("abort", async () => { + debug/* default */.Z.log("lipsync mode is abort"); + videoData = "" + await stopTranslation(); + }); + }); + document .querySelector(".translationBtn") diff --git a/dist/vot-min.user.js b/dist/vot-min.user.js index f4ace28f..19f70d7d 100644 --- a/dist/vot-min.user.js +++ b/dist/vot-min.user.js @@ -83,4 +83,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0,_="";f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),0===_.duration&&null===_||await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(f.log("lipsync mode is pause"),a.pause()),"stop"===e&&(f.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(f.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(f.log("lipsync mode is playing"),a.play()),"abort"===e&&(f.log("lipsync mode is abort"),await ae());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{_.detectedLanguage||(_=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")&&0!==e.duration||null!==e?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==te.author&&(te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}()),console.log("VOT Video Data: ",_),f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){const r=`${y[d]}${t}`;await async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),await e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),window.addEventListener("popstate",(async function(){await ae(),_="",f.log("popstate triggered")})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0,_="";f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){_="",a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(f.log("lipsync mode is pause"),a.pause()),"stop"===e&&(f.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(f.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(f.log("lipsync mode is playing"),a.play());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{_.detectedLanguage||(_=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==te.author&&(te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}()),console.log("VOT Video Data: ",_),f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){const r=`${y[d]}${t}`;await async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),await e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),window.addEventListener("popstate",(async function(){await ae(),f.log("popstate triggered")})),document.querySelectorAll("video").forEach((e=>{e.addEventListener("abort",(async()=>{f.log("lipsync mode is abort"),_="",await ae()}))})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot.user.js b/dist/vot.user.js index 2fe8ba3a..781d511e 100644 --- a/dist/vot.user.js +++ b/dist/vot.user.js @@ -2693,9 +2693,7 @@ async function src_main() { .querySelector("#VOTTranslateFromLang") .addEventListener("change", async (event) => { utils_debug.log("[onchange] select from language", event.target.value); - if (videoData.duration !== 0 || videoData !== null) { await setDetectedLangauge(videoData, event.target.value); - } }); menuOptions @@ -2950,6 +2948,7 @@ async function src_main() { async function stopTraslate() { // Default actions on stop translate + videoData = "" audio.pause(); video.removeEventListener(".translate", stopTraslate, false); await deleteAudioSrc(); @@ -2999,7 +2998,7 @@ async function src_main() { videoData.responseLanguage = translateToLang; - if (window.location.hostname.includes("youtube.com") && videoData.duration !== 0 || videoData !== null ) { + if (window.location.hostname.includes("youtube.com")) { ytData = await getYTVideoData(); if (ytData.author !== "") { ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); @@ -3071,10 +3070,6 @@ async function src_main() { utils_debug.log("lipsync mode is playing"); audio.play(); } - if (mode === "abort") { - utils_debug.log("lipsync mode is abort"); - await stopTranslation(); - } }; async function addVideoSlider() { @@ -3371,7 +3366,6 @@ async function src_main() { "playing", "ratechange", "play", - "abort", "waiting", "pause", ]; @@ -3473,9 +3467,16 @@ async function src_main() { ); window.addEventListener("popstate", async function () { await stopTranslation() - videoData = "" utils_debug.log("popstate triggered") }); + document.querySelectorAll("video").forEach(video => { + video.addEventListener("abort", async () => { + utils_debug.log("lipsync mode is abort"); + videoData = "" + await stopTranslation(); + }); + }); + document .querySelector(".translationBtn") diff --git a/src/index.js b/src/index.js index ea0ef096..abfd5004 100644 --- a/src/index.js +++ b/src/index.js @@ -302,9 +302,7 @@ async function main() { .querySelector("#VOTTranslateFromLang") .addEventListener("change", async (event) => { debug.log("[onchange] select from language", event.target.value); - if (videoData.duration !== 0 || videoData !== null) { await setDetectedLangauge(videoData, event.target.value); - } }); menuOptions @@ -578,6 +576,7 @@ async function main() { async function stopTraslate() { // Default actions on stop translate + videoData = "" audio.pause(); video.removeEventListener(".translate", stopTraslate, false); await deleteAudioSrc(); @@ -627,7 +626,7 @@ async function main() { videoData.responseLanguage = translateToLang; - if (window.location.hostname.includes("youtube.com") && videoData.duration !== 0 || videoData !== null ) { + if (window.location.hostname.includes("youtube.com")) { ytData = await getYTVideoData(); if (ytData.author !== "") { ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); @@ -699,10 +698,6 @@ async function main() { debug.log("lipsync mode is playing"); audio.play(); } - if (mode === "abort") { - debug.log("lipsync mode is abort"); - await stopTranslation(); - } }; async function addVideoSlider() { @@ -1009,7 +1004,6 @@ async function main() { "playing", "ratechange", "play", - "abort", "waiting", "pause", ]; @@ -1111,9 +1105,16 @@ async function main() { ); window.addEventListener("popstate", async function () { await stopTranslation() - videoData = "" debug.log("popstate triggered") }); + document.querySelectorAll("video").forEach(video => { + video.addEventListener("abort", async () => { + debug.log("lipsync mode is abort"); + videoData = "" + await stopTranslation(); + }); + }); + document .querySelector(".translationBtn") From c7e3314b7c85b2e8d5833dd9bd2388181114aaf6 Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Wed, 2 Aug 2023 07:31:20 +0400 Subject: [PATCH 39/48] Add files via upload --- dist/vot-cloudflare-min.user.js | 2 +- dist/vot-cloudflare.user.js | 9 +++++---- dist/vot-min.user.js | 2 +- dist/vot.user.js | 9 +++++---- src/index.js | 9 +++++---- 5 files changed, 17 insertions(+), 14 deletions(-) diff --git a/dist/vot-cloudflare-min.user.js b/dist/vot-cloudflare-min.user.js index b7bf1d96..a24ee83b 100644 --- a/dist/vot-cloudflare-min.user.js +++ b/dist/vot-cloudflare-min.user.js @@ -84,4 +84,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let f=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function b(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),b("#7A7A7D"),V(e);break;case"success":w(e),b("#A36EFF"),V(e);break;default:w("none"),b("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}f in v.Iz||(f="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],A=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],z=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,z)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[f].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[f].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[f].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[f].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[f].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[f].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...A];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${f}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,b,V,w,L,F,M,A,z,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0,$="";y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[f].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[f].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[f].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[f][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[f].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[f][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[f].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[f].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[f].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[f].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,A=e.dontTranslateYourLang,q=e.audioProxy,z=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[f].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[f].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",A,v.Iz[f].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),A=t,y.Z.log("dontTranslateYourLang value changed. New value: ",A)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[f].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[f].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",z,v.Iz[f].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),z=t,y.Z.log("syncVolume value changed. New value: ",z)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[f].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=f,Object.keys(v.tW).includes(t)?(await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==f&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===f&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){$="",o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[f].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===z&&(b=Number(e))}O("none",v.Iz[f].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[f].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[f].neededAdditionalExtension:v.Iz[f].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);b=e;const t=x("VOTVideoSlider",e,`${v.Iz[f].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==z)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,b);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,b=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{$.detectedLanguage||($=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==ee.author&&(ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}()),console.log("VOT Video Data: ",$),y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===A&&ee.detectedLanguage===f&&ee.responseLanguage===f)throw v.Iz[f].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[f].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[f].VOTPremiere;if($.duration>14400)throw v.Iz[f].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,await e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[f].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[f].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[f].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[f].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[f].translationTakeAboutMinute:v.Iz[f].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[f].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[f].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[f].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[f].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;b=e;const t=x("VOTTranslationSlider",e,`${v.Iz[f].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===z&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),b=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),window.addEventListener("popstate",(async function(){await oe(),y.Z.log("popstate triggered")})),document.querySelectorAll("video").forEach((e=>{e.addEventListener("abort",(async()=>{y.Z.log("lipsync mode is abort"),$="",await oe()}))})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[f].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[f].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(A.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let f=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function b(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),b("#7A7A7D"),V(e);break;case"success":w(e),b("#A36EFF"),V(e);break;default:w("none"),b("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}f in v.Iz||(f="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],A=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],z=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,z)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[f].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[f].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[f].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[f].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[f].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[f].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...A];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${f}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,b,V,w,L,F,M,A,z,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0,$="";y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[f].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[f].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[f].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[f][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[f].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[f][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[f].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[f].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[f].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[f].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,A=e.dontTranslateYourLang,q=e.audioProxy,z=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[f].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[f].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",A,v.Iz[f].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),A=t,y.Z.log("dontTranslateYourLang value changed. New value: ",A)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[f].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[f].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",z,v.Iz[f].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),z=t,y.Z.log("syncVolume value changed. New value: ",z)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[f].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=f,Object.keys(v.tW).includes(t)?(await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==f&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===f&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){$="",o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[f].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===z&&(b=Number(e))}O("none",v.Iz[f].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[f].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[f].neededAdditionalExtension:v.Iz[f].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);b=e;const t=x("VOTVideoSlider",e,`${v.Iz[f].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==z)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,b);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,b=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{$.detectedLanguage||($=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==ee.author&&(ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}()),console.log("VOT Video Data: ",$),y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===A&&ee.detectedLanguage===f&&ee.responseLanguage===f)throw v.Iz[f].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[f].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[f].VOTPremiere;if($.duration>14400)throw v.Iz[f].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,await e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[f].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[f].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[f].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[f].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[f].translationTakeAboutMinute:v.Iz[f].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[f].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[f].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[f].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[f].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;b=e;const t=x("VOTTranslationSlider",e,`${v.Iz[f].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===z&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),b=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelectorAll("video").forEach((e=>{e.addEventListener("abort",(async()=>{y.Z.log("lipsync mode is abort"),$="",await oe()}))})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[f].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[f].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(A.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot-cloudflare.user.js b/dist/vot-cloudflare.user.js index 39667ad9..4ecce094 100644 --- a/dist/vot-cloudflare.user.js +++ b/dist/vot-cloudflare.user.js @@ -3546,10 +3546,11 @@ async function src_main() { document.addEventListener("touchend", (event) => changeOpacityOnEvent(event, timer, opacityRatio) ); - window.addEventListener("popstate", async function () { - await stopTranslation() - debug/* default */.Z.log("popstate triggered") - }); + // Возможно лишнее + // window.addEventListener("popstate", async function () { + // await stopTranslation() + // debug.log("popstate triggered") + // }); document.querySelectorAll("video").forEach(video => { video.addEventListener("abort", async () => { debug/* default */.Z.log("lipsync mode is abort"); diff --git a/dist/vot-min.user.js b/dist/vot-min.user.js index 19f70d7d..7e6aa8bc 100644 --- a/dist/vot-min.user.js +++ b/dist/vot-min.user.js @@ -83,4 +83,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0,_="";f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){_="",a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(f.log("lipsync mode is pause"),a.pause()),"stop"===e&&(f.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(f.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(f.log("lipsync mode is playing"),a.play());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{_.detectedLanguage||(_=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==te.author&&(te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}()),console.log("VOT Video Data: ",_),f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){const r=`${y[d]}${t}`;await async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),await e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),window.addEventListener("popstate",(async function(){await ae(),f.log("popstate triggered")})),document.querySelectorAll("video").forEach((e=>{e.addEventListener("abort",(async()=>{f.log("lipsync mode is abort"),_="",await ae()}))})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0,_="";f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){_="",a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(f.log("lipsync mode is pause"),a.pause()),"stop"===e&&(f.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(f.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(f.log("lipsync mode is playing"),a.play());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{_.detectedLanguage||(_=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==te.author&&(te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}()),console.log("VOT Video Data: ",_),f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){const r=`${y[d]}${t}`;await async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),await e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelectorAll("video").forEach((e=>{e.addEventListener("abort",(async()=>{f.log("lipsync mode is abort"),_="",await ae()}))})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot.user.js b/dist/vot.user.js index 781d511e..cc6dc0ae 100644 --- a/dist/vot.user.js +++ b/dist/vot.user.js @@ -3465,10 +3465,11 @@ async function src_main() { document.addEventListener("touchend", (event) => changeOpacityOnEvent(event, timer, opacityRatio) ); - window.addEventListener("popstate", async function () { - await stopTranslation() - utils_debug.log("popstate triggered") - }); + // Возможно лишнее + // window.addEventListener("popstate", async function () { + // await stopTranslation() + // debug.log("popstate triggered") + // }); document.querySelectorAll("video").forEach(video => { video.addEventListener("abort", async () => { utils_debug.log("lipsync mode is abort"); diff --git a/src/index.js b/src/index.js index abfd5004..11ea0deb 100644 --- a/src/index.js +++ b/src/index.js @@ -1103,10 +1103,11 @@ async function main() { document.addEventListener("touchend", (event) => changeOpacityOnEvent(event, timer, opacityRatio) ); - window.addEventListener("popstate", async function () { - await stopTranslation() - debug.log("popstate triggered") - }); + // Возможно лишнее + // window.addEventListener("popstate", async function () { + // await stopTranslation() + // debug.log("popstate triggered") + // }); document.querySelectorAll("video").forEach(video => { video.addEventListener("abort", async () => { debug.log("lipsync mode is abort"); From cfacca66d54787b3fc983346d487dcbeea8ea266 Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Wed, 2 Aug 2023 09:46:21 +0400 Subject: [PATCH 40/48] Add files via upload --- dist/vot-cloudflare-min.user.js | 2 +- dist/vot-cloudflare.user.js | 5 +---- dist/vot-min.user.js | 2 +- dist/vot.user.js | 5 +---- src/index.js | 2 +- src/utils/getYTVideoData.js | 3 --- 6 files changed, 5 insertions(+), 14 deletions(-) diff --git a/dist/vot-cloudflare-min.user.js b/dist/vot-cloudflare-min.user.js index a24ee83b..14bb1142 100644 --- a/dist/vot-cloudflare-min.user.js +++ b/dist/vot-cloudflare-min.user.js @@ -84,4 +84,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let f=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function b(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),b("#7A7A7D"),V(e);break;case"success":w(e),b("#A36EFF"),V(e);break;default:w("none"),b("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}f in v.Iz||(f="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],A=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],z=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,z)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[f].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[f].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[f].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[f].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[f].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[f].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...A];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${f}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,b,V,w,L,F,M,A,z,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0,$="";y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[f].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[f].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[f].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[f][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[f].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[f][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[f].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[f].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[f].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[f].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,A=e.dontTranslateYourLang,q=e.audioProxy,z=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[f].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[f].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",A,v.Iz[f].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),A=t,y.Z.log("dontTranslateYourLang value changed. New value: ",A)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[f].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[f].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",z,v.Iz[f].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),z=t,y.Z.log("syncVolume value changed. New value: ",z)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[f].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=f,Object.keys(v.tW).includes(t)?(await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==f&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===f&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){$="",o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[f].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===z&&(b=Number(e))}O("none",v.Iz[f].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[f].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[f].neededAdditionalExtension:v.Iz[f].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);b=e;const t=x("VOTVideoSlider",e,`${v.Iz[f].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==z)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,b);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,b=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{$.detectedLanguage||($=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==ee.author&&(ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}()),console.log("VOT Video Data: ",$),y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===A&&ee.detectedLanguage===f&&ee.responseLanguage===f)throw v.Iz[f].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[f].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[f].VOTPremiere;if($.duration>14400)throw v.Iz[f].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,await e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[f].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[f].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[f].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[f].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[f].translationTakeAboutMinute:v.Iz[f].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[f].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[f].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[f].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[f].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;b=e;const t=x("VOTTranslationSlider",e,`${v.Iz[f].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===z&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),b=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelectorAll("video").forEach((e=>{e.addEventListener("abort",(async()=>{y.Z.log("lipsync mode is abort"),$="",await oe()}))})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[f].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[f].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(A.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],A=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],z=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,z)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...A];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,A,z,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0,$="";y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,A=e.dontTranslateYourLang,q=e.audioProxy,z=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",A,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),A=t,y.Z.log("dontTranslateYourLang value changed. New value: ",A)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",z,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),z=t,y.Z.log("syncVolume value changed. New value: ",z)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){$="",o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===z&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==z)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{$.detectedLanguage||($=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==ee.author&&(ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}()),y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===A&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){console.log("VOT Video Data: ",$);const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,await e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===z&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelectorAll("video").forEach((e=>{e.addEventListener("abort",(async()=>{y.Z.log("lipsync mode is abort"),$="",await oe()}))})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(A.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot-cloudflare.user.js b/dist/vot-cloudflare.user.js index 4ecce094..6faef51e 100644 --- a/dist/vot-cloudflare.user.js +++ b/dist/vot-cloudflare.user.js @@ -1560,9 +1560,6 @@ var update = injectStylesIntoStyleTag_default()(main/* default */.Z, options); ;// CONCATENATED MODULE: ./src/utils/getYTVideoData.js async function detect(cleanText) { - if (!cleanText) { - return; - } const response = await fetch("https://rust-server-531j.onrender.com/detect", { method: "POST", body: cleanText, @@ -3314,7 +3311,6 @@ async function src_main() { const translateExecutor = async (VIDEO_ID) => { if (!videoData.detectedLanguage) videoData = await getVideoData() - console.log("VOT Video Data: ", videoData); debug/* default */.Z.log("Run videoValidator"); await videoValidator(); debug/* default */.Z.log("Run translateFunc"); @@ -3339,6 +3335,7 @@ async function src_main() { // Define a function to translate a video and handle the callback async function translateFunc(VIDEO_ID, requestLang, responseLang) { + console.log("VOT Video Data: ", videoData); const videoURL = `${constants/* siteTranslates */.g$[siteHostname]}${VIDEO_ID}`; await translateVideo( videoURL, diff --git a/dist/vot-min.user.js b/dist/vot-min.user.js index 7e6aa8bc..ef5b49fb 100644 --- a/dist/vot-min.user.js +++ b/dist/vot-min.user.js @@ -83,4 +83,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){if(!e)return;const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0,_="";f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){_="",a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(f.log("lipsync mode is pause"),a.pause()),"stop"===e&&(f.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(f.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(f.log("lipsync mode is playing"),a.play());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{_.detectedLanguage||(_=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==te.author&&(te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}()),console.log("VOT Video Data: ",_),f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){const r=`${y[d]}${t}`;await async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),await e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelectorAll("video").forEach((e=>{e.addEventListener("abort",(async()=>{f.log("lipsync mode is abort"),_="",await ae()}))})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0,_="";f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){_="",a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(f.log("lipsync mode is pause"),a.pause()),"stop"===e&&(f.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(f.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(f.log("lipsync mode is playing"),a.play());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{_.detectedLanguage||(_=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==te.author&&(te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}()),f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){console.log("VOT Video Data: ",_);const r=`${y[d]}${t}`;await async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),await e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelectorAll("video").forEach((e=>{e.addEventListener("abort",(async()=>{f.log("lipsync mode is abort"),_="",await ae()}))})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot.user.js b/dist/vot.user.js index cc6dc0ae..0f1f97bc 100644 --- a/dist/vot.user.js +++ b/dist/vot.user.js @@ -1074,9 +1074,6 @@ var update = injectStylesIntoStyleTag_default()(main/* default */.Z, options); ;// CONCATENATED MODULE: ./src/utils/getYTVideoData.js async function detect(cleanText) { - if (!cleanText) { - return; - } const response = await fetch("https://rust-server-531j.onrender.com/detect", { method: "POST", body: cleanText, @@ -3243,7 +3240,6 @@ async function src_main() { const translateExecutor = async (VIDEO_ID) => { if (!videoData.detectedLanguage) videoData = await getVideoData() - console.log("VOT Video Data: ", videoData); utils_debug.log("Run videoValidator"); await videoValidator(); utils_debug.log("Run translateFunc"); @@ -3268,6 +3264,7 @@ async function src_main() { // Define a function to translate a video and handle the callback async function translateFunc(VIDEO_ID, requestLang, responseLang) { + console.log("VOT Video Data: ", videoData); const videoURL = `${siteTranslates[siteHostname]}${VIDEO_ID}`; await translateVideo( videoURL, diff --git a/src/index.js b/src/index.js index 11ea0deb..aa99fa2d 100644 --- a/src/index.js +++ b/src/index.js @@ -871,7 +871,6 @@ async function main() { const translateExecutor = async (VIDEO_ID) => { if (!videoData.detectedLanguage) videoData = await getVideoData() - console.log("VOT Video Data: ", videoData); debug.log("Run videoValidator"); await videoValidator(); debug.log("Run translateFunc"); @@ -896,6 +895,7 @@ async function main() { // Define a function to translate a video and handle the callback async function translateFunc(VIDEO_ID, requestLang, responseLang) { + console.log("VOT Video Data: ", videoData); const videoURL = `${siteTranslates[siteHostname]}${VIDEO_ID}`; await translateVideo( videoURL, diff --git a/src/utils/getYTVideoData.js b/src/utils/getYTVideoData.js index 27f196cb..e41d4009 100644 --- a/src/utils/getYTVideoData.js +++ b/src/utils/getYTVideoData.js @@ -1,7 +1,4 @@ async function detect(cleanText) { - if (!cleanText) { - return; - } const response = await fetch("https://rust-server-531j.onrender.com/detect", { method: "POST", body: cleanText, From 4cb2176355c7695ea28e79cb3f02088960161bbc Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Sun, 6 Aug 2023 00:55:39 +0400 Subject: [PATCH 41/48] Fix --- dist/vot-cloudflare-min.user.js | 2 +- dist/vot-cloudflare.user.js | 32 ++++++++++++++++---------------- dist/vot-min.user.js | 2 +- dist/vot.user.js | 32 ++++++++++++++++---------------- src/index.js | 32 ++++++++++++++++---------------- 5 files changed, 50 insertions(+), 50 deletions(-) diff --git a/dist/vot-cloudflare-min.user.js b/dist/vot-cloudflare-min.user.js index 14bb1142..227b5976 100644 --- a/dist/vot-cloudflare-min.user.js +++ b/dist/vot-cloudflare-min.user.js @@ -84,4 +84,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],A=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],z=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,z)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...A];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,A,z,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0,$="";y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,A=e.dontTranslateYourLang,q=e.audioProxy,z=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",A,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),A=t,y.Z.log("dontTranslateYourLang value changed. New value: ",A)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",z,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),z=t,y.Z.log("syncVolume value changed. New value: ",z)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,ee.responseLanguage=t)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(await U(e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t}return await U(e.detectedLanguage,e.responseLanguage),e}async function G(){$="",o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===z&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==z)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{$.detectedLanguage||($=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==ee.author&&(ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=ee.responseLanguage)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}()),y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===A&&ee.detectedLanguage===b&&ee.responseLanguage===b)throw v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){console.log("VOT Video Data: ",$);const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,await e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===z&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelectorAll("video").forEach((e=>{e.addEventListener("abort",(async()=>{y.Z.log("lipsync mode is abort"),$="",await oe()}))})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(A.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],A=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],z=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,z)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...A];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,A,z,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0,$="";y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,A=e.dontTranslateYourLang,q=e.audioProxy,z=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",A,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),A=t,y.Z.log("dontTranslateYourLang value changed. New value: ",A)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",z,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),z=t,y.Z.log("syncVolume value changed. New value: ",z)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t,n){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${t} to ${n}`),document.querySelector("#VOTTranslateFromLang").value=t,document.querySelector("#VOTTranslateToLang").value=n,console.log("VOT GOVNO",e.responseLanguage),e.responseLanguage=n)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(await U(e,e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t||b}return await U(e,e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===z&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==z)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{$.detectedLanguage||($=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==ee.author&&(ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}()),y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===A&&$.detectedLanguage===b&&$.responseLanguage===b)throw v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){console.log("VOT Video Data: ",$);const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,await e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===z&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelectorAll("video").forEach((e=>{e.addEventListener("abort",(async()=>{y.Z.log("lipsync mode is abort"),$.detectedLanguage="",await oe()}))})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),$.detectedLanguage="",void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(A.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot-cloudflare.user.js b/dist/vot-cloudflare.user.js index 6faef51e..c514efe8 100644 --- a/dist/vot-cloudflare.user.js +++ b/dist/vot-cloudflare.user.js @@ -2742,14 +2742,14 @@ async function src_main() { .querySelector("#VOTTranslateFromLang") .addEventListener("change", async (event) => { debug/* default */.Z.log("[onchange] select from language", event.target.value); - await setDetectedLangauge(videoData, event.target.value); + await setDetectedLangauge(videoData, event.target.value); }); menuOptions .querySelector("#VOTTranslateToLang") .addEventListener("change", async (event) => { debug/* default */.Z.log("[onchange] select to language", event.target.value); - videoData = await setResponseLangauge(videoData, event.target.value); + await setResponseLangauge(videoData, event.target.value); }); } @@ -2966,7 +2966,7 @@ async function src_main() { }); } - async function setSelectMenuValues(from, to) { + async function setSelectMenuValues(videoData, from, to) { const selectLanguages = document.querySelector("#VOTSelectLanguages"); if (!selectLanguages) { return; @@ -2974,7 +2974,8 @@ async function src_main() { console.log(`Set translation from ${from} to ${to}`); document.querySelector("#VOTTranslateFromLang").value = from; document.querySelector("#VOTTranslateToLang").value = to; - ytData.responseLanguage = to; + console.log("VOT GOVNO", videoData.responseLanguage) + videoData.responseLanguage = to; } // data - ytData or VideoData @@ -2985,20 +2986,20 @@ async function src_main() { return setDetectedLangauge(data, "en"); } - await setSelectMenuValues(data.detectedLanguage, data.responseLanguage); + await setSelectMenuValues(data, data.detectedLanguage, data.responseLanguage); return data; } // data - ytData or VideoData - async function setResponseLangauge(data, videolang) { - switch (videolang) { + async function setResponseLangauge(data, resplang) { + switch (resplang) { case "en": - data.responseLanguage = videolang; + data.responseLanguage = resplang; if (lang == "ru") data.detectedLanguage = "ru"; break; default: - if (!Object.keys(constants/* availableLangs */.tW).includes(videolang)) { + if (!Object.keys(constants/* availableLangs */.tW).includes(resplang)) { return setResponseLangauge(data, "ru"); } @@ -3006,17 +3007,16 @@ async function src_main() { data.detectedLanguage = "en"; } - data.responseLanguage = videolang; + data.responseLanguage = resplang || lang; } - await setSelectMenuValues(data.detectedLanguage, data.responseLanguage); + await setSelectMenuValues(data, data.detectedLanguage, data.responseLanguage); return data; } async function stopTraslate() { // Default actions on stop translate - videoData = "" audio.pause(); video.removeEventListener(".translate", stopTraslate, false); await deleteAudioSrc(); @@ -3071,7 +3071,6 @@ async function src_main() { if (ytData.author !== "") { ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); videoData.detectedLanguage = ytData.detectedLanguage; - videoData.responseLanguage = ytData.responseLanguage; } } else if ( window.location.hostname.includes("rutube") || @@ -3289,8 +3288,8 @@ async function src_main() { debug/* default */.Z.log("VideoValidator videoData: ", videoData); if ( dontTranslateYourLang === 1 && - ytData.detectedLanguage === lang && - ytData.responseLanguage === lang + videoData.detectedLanguage === lang && + videoData.responseLanguage === lang ) { throw constants/* translations */.Iz[lang].VOTDisableFromYourLang; } @@ -3551,7 +3550,7 @@ async function src_main() { document.querySelectorAll("video").forEach(video => { video.addEventListener("abort", async () => { debug/* default */.Z.log("lipsync mode is abort"); - videoData = "" + videoData.detectedLanguage = "" await stopTranslation(); }); }); @@ -3567,6 +3566,7 @@ async function src_main() { // check if the audio source is not empty if (audio.src) { debug/* default */.Z.log("[click translationBtn] audio.src is not empty"); + videoData.detectedLanguage = "" await stopTraslate(); return; } diff --git a/dist/vot-min.user.js b/dist/vot-min.user.js index ef5b49fb..7794ca36 100644 --- a/dist/vot-min.user.js +++ b/dist/vot-min.user.js @@ -83,4 +83,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0,_="";f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),_=await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${e} to ${t}`),document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,te.responseLanguage=t)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(await Y(e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t}return await Y(e.detectedLanguage,e.responseLanguage),e}async function Z(){_="",a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(f.log("lipsync mode is pause"),a.pause()),"stop"===e&&(f.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(f.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(f.log("lipsync mode is playing"),a.play());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{_.detectedLanguage||(_=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==te.author&&(te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage,e.responseLanguage=te.responseLanguage)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}()),f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&te.detectedLanguage===V&&te.responseLanguage===V)throw b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){console.log("VOT Video Data: ",_);const r=`${y[d]}${t}`;await async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),await e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelectorAll("video").forEach((e=>{e.addEventListener("abort",(async()=>{f.log("lipsync mode is abort"),_="",await ae()}))})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},V={log:(...e)=>{},translations:e=>{}};let f=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}f in b||(f="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[f].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[f].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[f].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[f].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[f].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[f].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){V.log("Loading extension..."),V.log(`Selected menu language: ${f}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(V.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[f].unSupportedExtensionError;return console.error(e),alert(e)}let t;V.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;V.log("[translateProccessor] execute on element: ",n);let B,z=!0,_="";V.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),V.log("video",c);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[f].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),V.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[f].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),V.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[f].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[f][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[f].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[f][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{V.log("[onchange] select from language",e.target.value),await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{V.log("[onchange] select to language",e.target.value),await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[f].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[f].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[f].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[f].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,V.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[f].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[f].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,V.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[f].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,V.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[f].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,V.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[f].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,V.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[f].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,V.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t,n){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${t} to ${n}`),document.querySelector("#VOTTranslateFromLang").value=t,document.querySelector("#VOTTranslateToLang").value=n,console.log("VOT GOVNO",e.responseLanguage),e.responseLanguage=n)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=f,Object.keys(v).includes(t)?(await Y(e,e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==f&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===f&&(e.detectedLanguage="en"),e.responseLanguage=t||f}return await Y(e,e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[f].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[f].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(V.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(V.log("lipsync mode is pause"),a.pause()),"stop"===e&&(V.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(V.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(V.log("lipsync mode is playing"),a.play());else{V.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[f].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[f].neededAdditionalExtension:b[f].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else V.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[f].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{_.detectedLanguage||(_=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==te.author&&(te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}()),V.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(V.log("VideoValidator videoData: ",_),1===E&&_.detectedLanguage===f&&_.responseLanguage===f)throw b[f].VOTDisableFromYourLang;if(te.isLive)throw b[f].VOTLiveNotSupported;if(te.isPremiere)throw b[f].VOTPremiere;if(_.duration>14400)throw b[f].VOTVideoIsTooLong}return!0}(),V.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){V.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){console.log("VOT Video Data: ",_);const r=`${y[d]}${t}`;await async function(t,n,a,o,i){V.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),await e(t,n,a,o,((e,t)=>{if(V.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[f].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[f].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[f].translationTakeMoreThanHour:t>=10&&t%10?b[f].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[f].translationTakeAboutMinute:b[f].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[f].translationTakeFewMinutes);break;case 3:i(!1,b[f].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(V.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[f].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[f].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[f].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);V.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelectorAll("video").forEach((e=>{e.addEventListener("abort",(async()=>{V.log("lipsync mode is abort"),_.detectedLanguage="",await ae()}))})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(V.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return V.log("[click translationBtn] audio.src is not empty"),_.detectedLanguage="",void await Z();try{V.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[f].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[f].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(V.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}V.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)V.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void V.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{V.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(V.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(V.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){V.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}V.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return V.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return V.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))V.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){V.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(V.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))V.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot.user.js b/dist/vot.user.js index 0f1f97bc..bbb08314 100644 --- a/dist/vot.user.js +++ b/dist/vot.user.js @@ -2690,14 +2690,14 @@ async function src_main() { .querySelector("#VOTTranslateFromLang") .addEventListener("change", async (event) => { utils_debug.log("[onchange] select from language", event.target.value); - await setDetectedLangauge(videoData, event.target.value); + await setDetectedLangauge(videoData, event.target.value); }); menuOptions .querySelector("#VOTTranslateToLang") .addEventListener("change", async (event) => { utils_debug.log("[onchange] select to language", event.target.value); - videoData = await setResponseLangauge(videoData, event.target.value); + await setResponseLangauge(videoData, event.target.value); }); } @@ -2895,7 +2895,7 @@ async function src_main() { }); } - async function setSelectMenuValues(from, to) { + async function setSelectMenuValues(videoData, from, to) { const selectLanguages = document.querySelector("#VOTSelectLanguages"); if (!selectLanguages) { return; @@ -2903,7 +2903,8 @@ async function src_main() { console.log(`Set translation from ${from} to ${to}`); document.querySelector("#VOTTranslateFromLang").value = from; document.querySelector("#VOTTranslateToLang").value = to; - ytData.responseLanguage = to; + console.log("VOT GOVNO", videoData.responseLanguage) + videoData.responseLanguage = to; } // data - ytData or VideoData @@ -2914,20 +2915,20 @@ async function src_main() { return setDetectedLangauge(data, "en"); } - await setSelectMenuValues(data.detectedLanguage, data.responseLanguage); + await setSelectMenuValues(data, data.detectedLanguage, data.responseLanguage); return data; } // data - ytData or VideoData - async function setResponseLangauge(data, videolang) { - switch (videolang) { + async function setResponseLangauge(data, resplang) { + switch (resplang) { case "en": - data.responseLanguage = videolang; + data.responseLanguage = resplang; if (lang == "ru") data.detectedLanguage = "ru"; break; default: - if (!Object.keys(availableLangs).includes(videolang)) { + if (!Object.keys(availableLangs).includes(resplang)) { return setResponseLangauge(data, "ru"); } @@ -2935,17 +2936,16 @@ async function src_main() { data.detectedLanguage = "en"; } - data.responseLanguage = videolang; + data.responseLanguage = resplang || lang; } - await setSelectMenuValues(data.detectedLanguage, data.responseLanguage); + await setSelectMenuValues(data, data.detectedLanguage, data.responseLanguage); return data; } async function stopTraslate() { // Default actions on stop translate - videoData = "" audio.pause(); video.removeEventListener(".translate", stopTraslate, false); await deleteAudioSrc(); @@ -3000,7 +3000,6 @@ async function src_main() { if (ytData.author !== "") { ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); videoData.detectedLanguage = ytData.detectedLanguage; - videoData.responseLanguage = ytData.responseLanguage; } } else if ( window.location.hostname.includes("rutube") || @@ -3218,8 +3217,8 @@ async function src_main() { utils_debug.log("VideoValidator videoData: ", videoData); if ( dontTranslateYourLang === 1 && - ytData.detectedLanguage === lang && - ytData.responseLanguage === lang + videoData.detectedLanguage === lang && + videoData.responseLanguage === lang ) { throw translations[lang].VOTDisableFromYourLang; } @@ -3470,7 +3469,7 @@ async function src_main() { document.querySelectorAll("video").forEach(video => { video.addEventListener("abort", async () => { utils_debug.log("lipsync mode is abort"); - videoData = "" + videoData.detectedLanguage = "" await stopTranslation(); }); }); @@ -3486,6 +3485,7 @@ async function src_main() { // check if the audio source is not empty if (audio.src) { utils_debug.log("[click translationBtn] audio.src is not empty"); + videoData.detectedLanguage = "" await stopTraslate(); return; } diff --git a/src/index.js b/src/index.js index aa99fa2d..96cda4e5 100644 --- a/src/index.js +++ b/src/index.js @@ -302,14 +302,14 @@ async function main() { .querySelector("#VOTTranslateFromLang") .addEventListener("change", async (event) => { debug.log("[onchange] select from language", event.target.value); - await setDetectedLangauge(videoData, event.target.value); + await setDetectedLangauge(videoData, event.target.value); }); menuOptions .querySelector("#VOTTranslateToLang") .addEventListener("change", async (event) => { debug.log("[onchange] select to language", event.target.value); - videoData = await setResponseLangauge(videoData, event.target.value); + await setResponseLangauge(videoData, event.target.value); }); } @@ -526,7 +526,7 @@ async function main() { }); } - async function setSelectMenuValues(from, to) { + async function setSelectMenuValues(videoData, from, to) { const selectLanguages = document.querySelector("#VOTSelectLanguages"); if (!selectLanguages) { return; @@ -534,7 +534,8 @@ async function main() { console.log(`Set translation from ${from} to ${to}`); document.querySelector("#VOTTranslateFromLang").value = from; document.querySelector("#VOTTranslateToLang").value = to; - ytData.responseLanguage = to; + console.log("VOT GOVNO", videoData.responseLanguage) + videoData.responseLanguage = to; } // data - ytData or VideoData @@ -545,20 +546,20 @@ async function main() { return setDetectedLangauge(data, "en"); } - await setSelectMenuValues(data.detectedLanguage, data.responseLanguage); + await setSelectMenuValues(data, data.detectedLanguage, data.responseLanguage); return data; } // data - ytData or VideoData - async function setResponseLangauge(data, videolang) { - switch (videolang) { + async function setResponseLangauge(data, resplang) { + switch (resplang) { case "en": - data.responseLanguage = videolang; + data.responseLanguage = resplang; if (lang == "ru") data.detectedLanguage = "ru"; break; default: - if (!Object.keys(availableLangs).includes(videolang)) { + if (!Object.keys(availableLangs).includes(resplang)) { return setResponseLangauge(data, "ru"); } @@ -566,17 +567,16 @@ async function main() { data.detectedLanguage = "en"; } - data.responseLanguage = videolang; + data.responseLanguage = resplang || lang; } - await setSelectMenuValues(data.detectedLanguage, data.responseLanguage); + await setSelectMenuValues(data, data.detectedLanguage, data.responseLanguage); return data; } async function stopTraslate() { // Default actions on stop translate - videoData = "" audio.pause(); video.removeEventListener(".translate", stopTraslate, false); await deleteAudioSrc(); @@ -631,7 +631,6 @@ async function main() { if (ytData.author !== "") { ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); videoData.detectedLanguage = ytData.detectedLanguage; - videoData.responseLanguage = ytData.responseLanguage; } } else if ( window.location.hostname.includes("rutube") || @@ -849,8 +848,8 @@ async function main() { debug.log("VideoValidator videoData: ", videoData); if ( dontTranslateYourLang === 1 && - ytData.detectedLanguage === lang && - ytData.responseLanguage === lang + videoData.detectedLanguage === lang && + videoData.responseLanguage === lang ) { throw translations[lang].VOTDisableFromYourLang; } @@ -1111,7 +1110,7 @@ async function main() { document.querySelectorAll("video").forEach(video => { video.addEventListener("abort", async () => { debug.log("lipsync mode is abort"); - videoData = "" + videoData.detectedLanguage = "" await stopTranslation(); }); }); @@ -1127,6 +1126,7 @@ async function main() { // check if the audio source is not empty if (audio.src) { debug.log("[click translationBtn] audio.src is not empty"); + videoData.detectedLanguage = "" await stopTraslate(); return; } From 5f42748a368d85a2ef0fa902d2da8511cf088a16 Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Sun, 6 Aug 2023 00:57:37 +0400 Subject: [PATCH 42/48] Add files via upload --- dist/vot-cloudflare-min.user.js | 2 +- dist/vot-cloudflare.user.js | 1 - dist/vot-min.user.js | 2 +- dist/vot.user.js | 1 - src/index.js | 1 - 5 files changed, 2 insertions(+), 5 deletions(-) diff --git a/dist/vot-cloudflare-min.user.js b/dist/vot-cloudflare-min.user.js index 227b5976..dfe648ed 100644 --- a/dist/vot-cloudflare-min.user.js +++ b/dist/vot-cloudflare-min.user.js @@ -84,4 +84,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],A=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],z=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,z)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...A];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,A,z,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0,$="";y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,A=e.dontTranslateYourLang,q=e.audioProxy,z=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",A,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),A=t,y.Z.log("dontTranslateYourLang value changed. New value: ",A)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",z,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),z=t,y.Z.log("syncVolume value changed. New value: ",z)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t,n){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${t} to ${n}`),document.querySelector("#VOTTranslateFromLang").value=t,document.querySelector("#VOTTranslateToLang").value=n,console.log("VOT GOVNO",e.responseLanguage),e.responseLanguage=n)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(await U(e,e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t||b}return await U(e,e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===z&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==z)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{$.detectedLanguage||($=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==ee.author&&(ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}()),y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===A&&$.detectedLanguage===b&&$.responseLanguage===b)throw v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){console.log("VOT Video Data: ",$);const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,await e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===z&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelectorAll("video").forEach((e=>{e.addEventListener("abort",(async()=>{y.Z.log("lipsync mode is abort"),$.detectedLanguage="",await oe()}))})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),$.detectedLanguage="",void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(A.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],A=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],z=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,z)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...A];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,A,z,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0,$="";y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,A=e.dontTranslateYourLang,q=e.audioProxy,z=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",A,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),A=t,y.Z.log("dontTranslateYourLang value changed. New value: ",A)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",z,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),z=t,y.Z.log("syncVolume value changed. New value: ",z)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t,n){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${t} to ${n}`),document.querySelector("#VOTTranslateFromLang").value=t,document.querySelector("#VOTTranslateToLang").value=n,e.responseLanguage=n)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(await U(e,e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t||b}return await U(e,e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===z&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==z)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{$.detectedLanguage||($=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==ee.author&&(ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}()),y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===A&&$.detectedLanguage===b&&$.responseLanguage===b)throw v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){console.log("VOT Video Data: ",$);const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,await e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===z&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelectorAll("video").forEach((e=>{e.addEventListener("abort",(async()=>{y.Z.log("lipsync mode is abort"),$.detectedLanguage="",await oe()}))})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),$.detectedLanguage="",void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(A.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot-cloudflare.user.js b/dist/vot-cloudflare.user.js index c514efe8..71dc754c 100644 --- a/dist/vot-cloudflare.user.js +++ b/dist/vot-cloudflare.user.js @@ -2974,7 +2974,6 @@ async function src_main() { console.log(`Set translation from ${from} to ${to}`); document.querySelector("#VOTTranslateFromLang").value = from; document.querySelector("#VOTTranslateToLang").value = to; - console.log("VOT GOVNO", videoData.responseLanguage) videoData.responseLanguage = to; } diff --git a/dist/vot-min.user.js b/dist/vot-min.user.js index 7794ca36..ef332d8f 100644 --- a/dist/vot-min.user.js +++ b/dist/vot-min.user.js @@ -83,4 +83,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},V={log:(...e)=>{},translations:e=>{}};let f=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}f in b||(f="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[f].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[f].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[f].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[f].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[f].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[f].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){V.log("Loading extension..."),V.log(`Selected menu language: ${f}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(V.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[f].unSupportedExtensionError;return console.error(e),alert(e)}let t;V.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;V.log("[translateProccessor] execute on element: ",n);let B,z=!0,_="";V.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),V.log("video",c);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[f].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),V.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[f].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),V.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[f].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[f][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[f].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[f][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{V.log("[onchange] select from language",e.target.value),await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{V.log("[onchange] select to language",e.target.value),await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[f].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[f].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[f].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[f].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,V.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[f].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[f].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,V.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[f].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,V.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[f].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,V.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[f].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,V.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[f].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,V.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t,n){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${t} to ${n}`),document.querySelector("#VOTTranslateFromLang").value=t,document.querySelector("#VOTTranslateToLang").value=n,console.log("VOT GOVNO",e.responseLanguage),e.responseLanguage=n)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=f,Object.keys(v).includes(t)?(await Y(e,e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==f&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===f&&(e.detectedLanguage="en"),e.responseLanguage=t||f}return await Y(e,e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[f].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[f].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(V.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(V.log("lipsync mode is pause"),a.pause()),"stop"===e&&(V.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(V.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(V.log("lipsync mode is playing"),a.play());else{V.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[f].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[f].neededAdditionalExtension:b[f].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else V.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[f].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{_.detectedLanguage||(_=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==te.author&&(te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}()),V.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(V.log("VideoValidator videoData: ",_),1===E&&_.detectedLanguage===f&&_.responseLanguage===f)throw b[f].VOTDisableFromYourLang;if(te.isLive)throw b[f].VOTLiveNotSupported;if(te.isPremiere)throw b[f].VOTPremiere;if(_.duration>14400)throw b[f].VOTVideoIsTooLong}return!0}(),V.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){V.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){console.log("VOT Video Data: ",_);const r=`${y[d]}${t}`;await async function(t,n,a,o,i){V.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),await e(t,n,a,o,((e,t)=>{if(V.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[f].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[f].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[f].translationTakeMoreThanHour:t>=10&&t%10?b[f].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[f].translationTakeAboutMinute:b[f].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[f].translationTakeFewMinutes);break;case 3:i(!1,b[f].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(V.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[f].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[f].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[f].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);V.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelectorAll("video").forEach((e=>{e.addEventListener("abort",(async()=>{V.log("lipsync mode is abort"),_.detectedLanguage="",await ae()}))})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(V.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return V.log("[click translationBtn] audio.src is not empty"),_.detectedLanguage="",void await Z();try{V.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[f].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[f].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(V.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}V.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)V.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void V.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{V.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(V.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(V.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){V.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}V.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return V.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return V.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))V.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){V.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(V.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))V.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0,_="";f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t,n){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${t} to ${n}`),document.querySelector("#VOTTranslateFromLang").value=t,document.querySelector("#VOTTranslateToLang").value=n,e.responseLanguage=n)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(await Y(e,e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t||V}return await Y(e,e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(f.log("lipsync mode is pause"),a.pause()),"stop"===e&&(f.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(f.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(f.log("lipsync mode is playing"),a.play());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{_.detectedLanguage||(_=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==te.author&&(te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}()),f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&_.detectedLanguage===V&&_.responseLanguage===V)throw b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){console.log("VOT Video Data: ",_);const r=`${y[d]}${t}`;await async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),await e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelectorAll("video").forEach((e=>{e.addEventListener("abort",(async()=>{f.log("lipsync mode is abort"),_.detectedLanguage="",await ae()}))})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),_.detectedLanguage="",void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot.user.js b/dist/vot.user.js index bbb08314..d9afe205 100644 --- a/dist/vot.user.js +++ b/dist/vot.user.js @@ -2903,7 +2903,6 @@ async function src_main() { console.log(`Set translation from ${from} to ${to}`); document.querySelector("#VOTTranslateFromLang").value = from; document.querySelector("#VOTTranslateToLang").value = to; - console.log("VOT GOVNO", videoData.responseLanguage) videoData.responseLanguage = to; } diff --git a/src/index.js b/src/index.js index 96cda4e5..589428fe 100644 --- a/src/index.js +++ b/src/index.js @@ -534,7 +534,6 @@ async function main() { console.log(`Set translation from ${from} to ${to}`); document.querySelector("#VOTTranslateFromLang").value = from; document.querySelector("#VOTTranslateToLang").value = to; - console.log("VOT GOVNO", videoData.responseLanguage) videoData.responseLanguage = to; } From 483ac7b805388f4d82536bf91f5353491ff68087 Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Sun, 6 Aug 2023 01:04:48 +0400 Subject: [PATCH 43/48] Add files via upload --- dist/vot-cloudflare-min.user.js | 2 +- dist/vot-cloudflare.user.js | 4 ++-- dist/vot-min.user.js | 2 +- dist/vot.user.js | 4 ++-- src/index.js | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dist/vot-cloudflare-min.user.js b/dist/vot-cloudflare-min.user.js index dfe648ed..399c879c 100644 --- a/dist/vot-cloudflare-min.user.js +++ b/dist/vot-cloudflare-min.user.js @@ -84,4 +84,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],A=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],z=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,z)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...A];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,A,z,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0,$="";y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,A=e.dontTranslateYourLang,q=e.audioProxy,z=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",A,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),A=t,y.Z.log("dontTranslateYourLang value changed. New value: ",A)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",z,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),z=t,y.Z.log("syncVolume value changed. New value: ",z)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t,n){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${t} to ${n}`),document.querySelector("#VOTTranslateFromLang").value=t,document.querySelector("#VOTTranslateToLang").value=n,e.responseLanguage=n)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(await U(e,e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t||b}return await U(e,e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===z&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==z)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{$.detectedLanguage||($=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==ee.author&&(ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}()),y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===A&&$.detectedLanguage===b&&$.responseLanguage===b)throw v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){console.log("VOT Video Data: ",$);const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,await e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===z&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelectorAll("video").forEach((e=>{e.addEventListener("abort",(async()=>{y.Z.log("lipsync mode is abort"),$.detectedLanguage="",await oe()}))})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),$.detectedLanguage="",void await G();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(A.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],A=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],z=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,z)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...A];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,A,z,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0,$="";y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,A=e.dontTranslateYourLang,q=e.audioProxy,z=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",A,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),A=t,y.Z.log("dontTranslateYourLang value changed. New value: ",A)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",z,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),z=t,y.Z.log("syncVolume value changed. New value: ",z)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t,n){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${t} to ${n}`),document.querySelector("#VOTTranslateFromLang").value=t,document.querySelector("#VOTTranslateToLang").value=n,e.responseLanguage=n)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(await U(e,e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t||b}return await U(e,e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===z&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==z)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{$.detectedLanguage||($=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==ee.author&&(ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}()),y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===A&&$.detectedLanguage===b&&$.responseLanguage===b)throw v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){console.log("VOT Video Data: ",$);const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,await e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(await oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===z&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelectorAll("video").forEach((e=>{e.addEventListener("abort",(async()=>{y.Z.log("lipsync mode is abort"),$.detectedLanguage="",await oe()}))})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),await oe(),void($.detectedLanguage="");try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(A.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot-cloudflare.user.js b/dist/vot-cloudflare.user.js index 71dc754c..56d53d53 100644 --- a/dist/vot-cloudflare.user.js +++ b/dist/vot-cloudflare.user.js @@ -3420,7 +3420,7 @@ async function src_main() { mutation.target === video && mutation.target.src !== "" ) { - stopTranslation(); + await stopTranslation(); firstPlay = true; } }); @@ -3565,8 +3565,8 @@ async function src_main() { // check if the audio source is not empty if (audio.src) { debug/* default */.Z.log("[click translationBtn] audio.src is not empty"); + await stopTranslation(); videoData.detectedLanguage = "" - await stopTraslate(); return; } diff --git a/dist/vot-min.user.js b/dist/vot-min.user.js index ef332d8f..1a9b0478 100644 --- a/dist/vot-min.user.js +++ b/dist/vot-min.user.js @@ -83,4 +83,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0,_="";f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t,n){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${t} to ${n}`),document.querySelector("#VOTTranslateFromLang").value=t,document.querySelector("#VOTTranslateToLang").value=n,e.responseLanguage=n)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(await Y(e,e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t||V}return await Y(e,e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(f.log("lipsync mode is pause"),a.pause()),"stop"===e&&(f.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(f.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(f.log("lipsync mode is playing"),a.play());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{_.detectedLanguage||(_=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==te.author&&(te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}()),f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&_.detectedLanguage===V&&_.responseLanguage===V)throw b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){console.log("VOT Video Data: ",_);const r=`${y[d]}${t}`;await async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),await e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelectorAll("video").forEach((e=>{e.addEventListener("abort",(async()=>{f.log("lipsync mode is abort"),_.detectedLanguage="",await ae()}))})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),_.detectedLanguage="",void await Z();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0,_="";f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t,n){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${t} to ${n}`),document.querySelector("#VOTTranslateFromLang").value=t,document.querySelector("#VOTTranslateToLang").value=n,e.responseLanguage=n)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(await Y(e,e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t||V}return await Y(e,e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(f.log("lipsync mode is pause"),a.pause()),"stop"===e&&(f.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(f.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(f.log("lipsync mode is playing"),a.play());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{_.detectedLanguage||(_=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==te.author&&(te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}()),f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&_.detectedLanguage===V&&_.responseLanguage===V)throw b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){console.log("VOT Video Data: ",_);const r=`${y[d]}${t}`;await async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),await e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(await ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelectorAll("video").forEach((e=>{e.addEventListener("abort",(async()=>{f.log("lipsync mode is abort"),_.detectedLanguage="",await ae()}))})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),await ae(),void(_.detectedLanguage="");try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot.user.js b/dist/vot.user.js index d9afe205..6f0f34c0 100644 --- a/dist/vot.user.js +++ b/dist/vot.user.js @@ -3339,7 +3339,7 @@ async function src_main() { mutation.target === video && mutation.target.src !== "" ) { - stopTranslation(); + await stopTranslation(); firstPlay = true; } }); @@ -3484,8 +3484,8 @@ async function src_main() { // check if the audio source is not empty if (audio.src) { utils_debug.log("[click translationBtn] audio.src is not empty"); + await stopTranslation(); videoData.detectedLanguage = "" - await stopTraslate(); return; } diff --git a/src/index.js b/src/index.js index 589428fe..ef016db1 100644 --- a/src/index.js +++ b/src/index.js @@ -980,7 +980,7 @@ async function main() { mutation.target === video && mutation.target.src !== "" ) { - stopTranslation(); + await stopTranslation(); firstPlay = true; } }); @@ -1125,8 +1125,8 @@ async function main() { // check if the audio source is not empty if (audio.src) { debug.log("[click translationBtn] audio.src is not empty"); + await stopTranslation(); videoData.detectedLanguage = "" - await stopTraslate(); return; } From 310c604a4f8b7c30ba9c873c437f05ae75e21ffc Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Sun, 6 Aug 2023 03:13:17 +0400 Subject: [PATCH 44/48] Fix #2 --- dist/vot-cloudflare-min.user.js | 2 +- dist/vot-cloudflare.user.js | 5 ++--- dist/vot-min.user.js | 2 +- dist/vot.user.js | 5 ++--- src/index.js | 5 ++--- 5 files changed, 8 insertions(+), 11 deletions(-) diff --git a/dist/vot-cloudflare-min.user.js b/dist/vot-cloudflare-min.user.js index 399c879c..e8b6eb94 100644 --- a/dist/vot-cloudflare-min.user.js +++ b/dist/vot-cloudflare-min.user.js @@ -84,4 +84,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],A=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],z=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,z)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...A];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,A,z,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0,$="";y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,A=e.dontTranslateYourLang,q=e.audioProxy,z=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",A,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),A=t,y.Z.log("dontTranslateYourLang value changed. New value: ",A)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",z,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),z=t,y.Z.log("syncVolume value changed. New value: ",z)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t,n){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${t} to ${n}`),document.querySelector("#VOTTranslateFromLang").value=t,document.querySelector("#VOTTranslateToLang").value=n,e.responseLanguage=n)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(await U(e,e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t||b}return await U(e,e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===z&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==z)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{$.detectedLanguage||($=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==ee.author&&(ee=await Y(ee,ee.detectedLanguage),e.detectedLanguage=ee.detectedLanguage)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}()),y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===A&&$.detectedLanguage===b&&$.responseLanguage===b)throw v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){console.log("VOT Video Data: ",$);const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,await e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(await oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===z&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelectorAll("video").forEach((e=>{e.addEventListener("abort",(async()=>{y.Z.log("lipsync mode is abort"),$.detectedLanguage="",await oe()}))})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),await oe(),void($.detectedLanguage="");try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(A.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],A=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],z=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,z)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...A];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,A,z,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0,$="";y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,A=e.dontTranslateYourLang,q=e.audioProxy,z=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",A,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),A=t,y.Z.log("dontTranslateYourLang value changed. New value: ",A)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",z,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),z=t,y.Z.log("syncVolume value changed. New value: ",z)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t,n){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${t} to ${n}`),document.querySelector("#VOTTranslateFromLang").value=t,document.querySelector("#VOTTranslateToLang").value=n,e.responseLanguage=n)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(await U(e,e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t||b}return await U(e,e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===z&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==z)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{$.detectedLanguage||($=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==ee.author&&(e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=b,ee=await Y(ee,e.detectedLanguage))):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}()),y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===A&&$.detectedLanguage===b&&$.responseLanguage===b)throw v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){console.log("VOT Video Data: ",$);const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,await e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(await oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===z&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelectorAll("video").forEach((e=>{e.addEventListener("abort",(async()=>{y.Z.log("lipsync mode is abort"),await oe()}))})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await oe();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(A.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot-cloudflare.user.js b/dist/vot-cloudflare.user.js index 56d53d53..5dee1fec 100644 --- a/dist/vot-cloudflare.user.js +++ b/dist/vot-cloudflare.user.js @@ -3068,8 +3068,9 @@ async function src_main() { if (window.location.hostname.includes("youtube.com")) { ytData = await getYTVideoData(); if (ytData.author !== "") { - ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); videoData.detectedLanguage = ytData.detectedLanguage; + videoData.responseLanguage = lang; + ytData = await setDetectedLangauge(ytData, videoData.detectedLanguage); } } else if ( window.location.hostname.includes("rutube") || @@ -3549,7 +3550,6 @@ async function src_main() { document.querySelectorAll("video").forEach(video => { video.addEventListener("abort", async () => { debug/* default */.Z.log("lipsync mode is abort"); - videoData.detectedLanguage = "" await stopTranslation(); }); }); @@ -3566,7 +3566,6 @@ async function src_main() { if (audio.src) { debug/* default */.Z.log("[click translationBtn] audio.src is not empty"); await stopTranslation(); - videoData.detectedLanguage = "" return; } diff --git a/dist/vot-min.user.js b/dist/vot-min.user.js index 1a9b0478..7ca15c41 100644 --- a/dist/vot-min.user.js +++ b/dist/vot-min.user.js @@ -83,4 +83,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0,_="";f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t,n){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${t} to ${n}`),document.querySelector("#VOTTranslateFromLang").value=t,document.querySelector("#VOTTranslateToLang").value=n,e.responseLanguage=n)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(await Y(e,e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t||V}return await Y(e,e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(f.log("lipsync mode is pause"),a.pause()),"stop"===e&&(f.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(f.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(f.log("lipsync mode is playing"),a.play());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{_.detectedLanguage||(_=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==te.author&&(te=await G(te,te.detectedLanguage),e.detectedLanguage=te.detectedLanguage)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}()),f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&_.detectedLanguage===V&&_.responseLanguage===V)throw b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){console.log("VOT Video Data: ",_);const r=`${y[d]}${t}`;await async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),await e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(await ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelectorAll("video").forEach((e=>{e.addEventListener("abort",(async()=>{f.log("lipsync mode is abort"),_.detectedLanguage="",await ae()}))})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),await ae(),void(_.detectedLanguage="");try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0,_="";f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t,n){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${t} to ${n}`),document.querySelector("#VOTTranslateFromLang").value=t,document.querySelector("#VOTTranslateToLang").value=n,e.responseLanguage=n)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(await Y(e,e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t||V}return await Y(e,e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(f.log("lipsync mode is pause"),a.pause()),"stop"===e&&(f.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(f.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(f.log("lipsync mode is playing"),a.play());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{_.detectedLanguage||(_=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==te.author&&(e.detectedLanguage=te.detectedLanguage,e.responseLanguage=V,te=await G(te,e.detectedLanguage))):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}()),f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&_.detectedLanguage===V&&_.responseLanguage===V)throw b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){console.log("VOT Video Data: ",_);const r=`${y[d]}${t}`;await async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),await e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(await ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelectorAll("video").forEach((e=>{e.addEventListener("abort",(async()=>{f.log("lipsync mode is abort"),await ae()}))})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await ae();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot.user.js b/dist/vot.user.js index 6f0f34c0..b9f0f8e5 100644 --- a/dist/vot.user.js +++ b/dist/vot.user.js @@ -2997,8 +2997,9 @@ async function src_main() { if (window.location.hostname.includes("youtube.com")) { ytData = await getYTVideoData(); if (ytData.author !== "") { - ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); videoData.detectedLanguage = ytData.detectedLanguage; + videoData.responseLanguage = lang; + ytData = await setDetectedLangauge(ytData, videoData.detectedLanguage); } } else if ( window.location.hostname.includes("rutube") || @@ -3468,7 +3469,6 @@ async function src_main() { document.querySelectorAll("video").forEach(video => { video.addEventListener("abort", async () => { utils_debug.log("lipsync mode is abort"); - videoData.detectedLanguage = "" await stopTranslation(); }); }); @@ -3485,7 +3485,6 @@ async function src_main() { if (audio.src) { utils_debug.log("[click translationBtn] audio.src is not empty"); await stopTranslation(); - videoData.detectedLanguage = "" return; } diff --git a/src/index.js b/src/index.js index ef016db1..3885643b 100644 --- a/src/index.js +++ b/src/index.js @@ -628,8 +628,9 @@ async function main() { if (window.location.hostname.includes("youtube.com")) { ytData = await getYTVideoData(); if (ytData.author !== "") { - ytData = await setDetectedLangauge(ytData, ytData.detectedLanguage); videoData.detectedLanguage = ytData.detectedLanguage; + videoData.responseLanguage = lang; + ytData = await setDetectedLangauge(ytData, videoData.detectedLanguage); } } else if ( window.location.hostname.includes("rutube") || @@ -1109,7 +1110,6 @@ async function main() { document.querySelectorAll("video").forEach(video => { video.addEventListener("abort", async () => { debug.log("lipsync mode is abort"); - videoData.detectedLanguage = "" await stopTranslation(); }); }); @@ -1126,7 +1126,6 @@ async function main() { if (audio.src) { debug.log("[click translationBtn] audio.src is not empty"); await stopTranslation(); - videoData.detectedLanguage = "" return; } From 0e6fc3d1bb74b31c31f8aef2dd538bbd28504a02 Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Sun, 6 Aug 2023 03:29:47 +0400 Subject: [PATCH 45/48] Add files via upload --- dist/vot-cloudflare-min.user.js | 2 +- dist/vot-cloudflare.user.js | 22 +++++++--------------- dist/vot-min.user.js | 2 +- dist/vot.user.js | 22 +++++++--------------- src/index.js | 22 +++++++--------------- 5 files changed, 23 insertions(+), 47 deletions(-) diff --git a/dist/vot-cloudflare-min.user.js b/dist/vot-cloudflare-min.user.js index e8b6eb94..1984c5e6 100644 --- a/dist/vot-cloudflare-min.user.js +++ b/dist/vot-cloudflare-min.user.js @@ -84,4 +84,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],A=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],z=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,z)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...A];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,A,z,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0,$="";y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,A=e.dontTranslateYourLang,q=e.audioProxy,z=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",A,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),A=t,y.Z.log("dontTranslateYourLang value changed. New value: ",A)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",z,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),z=t,y.Z.log("syncVolume value changed. New value: ",z)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t,n){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${t} to ${n}`),document.querySelector("#VOTTranslateFromLang").value=t,document.querySelector("#VOTTranslateToLang").value=n,e.responseLanguage=n)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(await U(e,e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==b&&(e.detectedLanguage="ru");else{if(!Object.keys(v.tW).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===b&&(e.detectedLanguage="en"),e.responseLanguage=t||b}return await U(e,e.detectedLanguage,e.responseLanguage),e}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===z&&(f=Number(e))}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function X(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==z)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const te=async e=>{$.detectedLanguage||($=await async function(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==ee.author&&(e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=b,ee=await Y(ee,e.detectedLanguage))):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}()),y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===A&&$.detectedLanguage===b&&$.responseLanguage===b)throw v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await J(e.type)}async function oe(){await G(),await K()}async function ae(t,a,i){console.log("VOT Video Data: ",$);const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,await e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(await oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&J("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===z&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelectorAll("video").forEach((e=>{e.addEventListener("abort",(async()=>{y.Z.log("lipsync mode is abort"),await oe()}))})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await oe();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await te(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await te(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(A.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],A=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],z=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,z)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...A];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,A,z,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0,$="";y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$||($=await J()),await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,A=e.dontTranslateYourLang,q=e.audioProxy,z=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",A,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),A=t,y.Z.log("dontTranslateYourLang value changed. New value: ",A)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?te():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",z,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),z=t,y.Z.log("syncVolume value changed. New value: ",z)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t,n){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${t} to ${n}`),document.querySelector("#VOTTranslateFromLang").value=t,document.querySelector("#VOTTranslateToLang").value=n,e.responseLanguage=n)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(await U(e,e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){return e.responseLanguage=t,Object.keys(v.tW).includes(t)?(await U(e,e.detectedLanguage,e.responseLanguage),e):W(e,"ru")}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===z&&(f=Number(e))}async function J(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==ee.author&&(e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=b,ee=await Y(ee,e.detectedLanguage))):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const X=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function te(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==z)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const ne=async e=>{$.detectedLanguage||($=await J()),y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===A&&$.detectedLanguage===b&&$.responseLanguage===b)throw v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ie(e,$.detectedLanguage,$.responseLanguage)};async function oe(e){y.Z.log(`video ${e.type}`),await X(e.type)}async function ae(){await G(),await K()}async function ie(t,a,i){console.log("VOT Video Data: ",$);const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,await e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ie(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(await ae(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&X("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,oe))))),O("success",v.Iz[b].disableTranslate),await te(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===z&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const re=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?re(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&re(document.querySelector("#player"),["mousemove","mouseout"],l):re("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelectorAll("video").forEach((e=>{e.addEventListener("abort",(async()=>{y.Z.log("lipsync mode is abort"),await ae(),$=""}))})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await ae();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await ne(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await ne(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(A.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot-cloudflare.user.js b/dist/vot-cloudflare.user.js index 5dee1fec..2ad0ae85 100644 --- a/dist/vot-cloudflare.user.js +++ b/dist/vot-cloudflare.user.js @@ -2749,6 +2749,9 @@ async function src_main() { .querySelector("#VOTTranslateToLang") .addEventListener("change", async (event) => { debug/* default */.Z.log("[onchange] select to language", event.target.value); + if (!videoData) { + videoData = await getVideoData() + } await setResponseLangauge(videoData, event.target.value); }); } @@ -2992,21 +2995,9 @@ async function src_main() { // data - ytData or VideoData async function setResponseLangauge(data, resplang) { - switch (resplang) { - case "en": - data.responseLanguage = resplang; - if (lang == "ru") data.detectedLanguage = "ru"; - break; - default: - if (!Object.keys(constants/* availableLangs */.tW).includes(resplang)) { - return setResponseLangauge(data, "ru"); - } - - if (data.detectedLanguage && data.responseLanguage === lang) { - data.detectedLanguage = "en"; - } - - data.responseLanguage = resplang || lang; + data.responseLanguage = resplang; + if (!Object.keys(constants/* availableLangs */.tW).includes(resplang)) { + return setResponseLangauge(data, "ru"); } await setSelectMenuValues(data, data.detectedLanguage, data.responseLanguage); @@ -3551,6 +3542,7 @@ async function src_main() { video.addEventListener("abort", async () => { debug/* default */.Z.log("lipsync mode is abort"); await stopTranslation(); + videoData = "" }); }); diff --git a/dist/vot-min.user.js b/dist/vot-min.user.js index 7ca15c41..fa0abfeb 100644 --- a/dist/vot-min.user.js +++ b/dist/vot-min.user.js @@ -83,4 +83,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},f={log:(...e)=>{},translations:e=>{}};let V=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}V in b||(V="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[V].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[V].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[V].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[V].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){f.log("Loading extension..."),f.log(`Selected menu language: ${V}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(f.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[V].unSupportedExtensionError;return console.error(e),alert(e)}let t;f.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;f.log("[translateProccessor] execute on element: ",n);let B,z=!0,_="";f.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),f.log("video",c);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[V].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),f.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[V].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),f.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[V].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[V].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[V][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{f.log("[onchange] select from language",e.target.value),await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{f.log("[onchange] select to language",e.target.value),await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[V].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[V].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[V].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[V].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,f.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[V].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[V].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,f.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[V].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,f.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[V].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,f.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[V].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,f.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?X():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[V].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,f.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t,n){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${t} to ${n}`),document.querySelector("#VOTTranslateFromLang").value=t,document.querySelector("#VOTTranslateToLang").value=n,e.responseLanguage=n)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=V,Object.keys(v).includes(t)?(await Y(e,e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){if("en"===t)e.responseLanguage=t,"ru"==V&&(e.detectedLanguage="ru");else{if(!Object.keys(v).includes(t))return W(e,"ru");e.detectedLanguage&&e.responseLanguage===V&&(e.detectedLanguage="en"),e.responseLanguage=t||V}return await Y(e,e.detectedLanguage,e.responseLanguage),e}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[V].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}x("none",b[V].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const J=async(e=!1)=>{if(f.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(f.log("lipsync mode is pause"),a.pause()),"stop"===e&&(f.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(f.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(f.log("lipsync mode is playing"),a.play());else{f.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[V].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[V].neededAdditionalExtension:b[V].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else f.log("lipsync mode is not set")};async function X(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[V].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const Q=async e=>{_.detectedLanguage||(_=await async function(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==te.author&&(e.detectedLanguage=te.detectedLanguage,e.responseLanguage=V,te=await G(te,e.detectedLanguage))):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}()),f.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(f.log("VideoValidator videoData: ",_),1===E&&_.detectedLanguage===V&&_.responseLanguage===V)throw b[V].VOTDisableFromYourLang;if(te.isLive)throw b[V].VOTLiveNotSupported;if(te.isPremiere)throw b[V].VOTPremiere;if(_.duration>14400)throw b[V].VOTVideoIsTooLong}return!0}(),f.log("Run translateFunc"),await oe(e,_.detectedLanguage,_.responseLanguage)};async function ne(e){f.log(`video ${e.type}`),await J(e.type)}async function ae(){await Z(),await K()}async function oe(t,o,i){console.log("VOT Video Data: ",_);const r=`${y[d]}${t}`;await async function(t,n,a,o,i){f.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),await e(t,n,a,o,((e,t)=>{if(f.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[V].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[V].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[V].translationTakeMoreThanHour:t>=10&&t%10?b[V].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[V].translationTakeAboutMinute:b[V].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[V].translationTakeFewMinutes);break;case 3:i(!1,b[V].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(f.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[V].translationTake)&&(clearTimeout(p),p=setTimeout((()=>oe(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(await ae(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&J("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ne))))),x("success",b[V].disableTranslate),await X(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[V].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);f.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelectorAll("video").forEach((e=>{e.addEventListener("abort",(async()=>{f.log("lipsync mode is abort"),await ae()}))})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(f.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return f.log("[click translationBtn] audio.src is not empty"),void await ae();try{f.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[V].VOTNoVideoIDFound;await Q(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[V].VOTNoVideoIDFound;try{await Q(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(f.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}f.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)f.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void f.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{f.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(f.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(f.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){f.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}f.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return f.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return f.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))f.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){f.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(f.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))f.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},V={log:(...e)=>{},translations:e=>{}};let f=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}f in b||(f="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[f].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[f].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[f].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[f].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[f].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[f].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){V.log("Loading extension..."),V.log(`Selected menu language: ${f}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(V.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[f].unSupportedExtensionError;return console.error(e),alert(e)}let t;V.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;V.log("[translateProccessor] execute on element: ",n);let B,z=!0,_="";V.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),V.log("video",c);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[f].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),V.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[f].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),V.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[f].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[f][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[f].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[f][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{V.log("[onchange] select from language",e.target.value),await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{V.log("[onchange] select to language",e.target.value),_||(_=await J()),await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[f].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[f].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[f].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[f].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,V.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[f].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[f].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,V.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[f].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,V.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[f].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,V.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[f].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,V.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?Q():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[f].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,V.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t,n){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${t} to ${n}`),document.querySelector("#VOTTranslateFromLang").value=t,document.querySelector("#VOTTranslateToLang").value=n,e.responseLanguage=n)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=f,Object.keys(v).includes(t)?(await Y(e,e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){return e.responseLanguage=t,Object.keys(v).includes(t)?(await Y(e,e.detectedLanguage,e.responseLanguage),e):W(e,"ru")}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[f].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}async function J(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==te.author&&(e.detectedLanguage=te.detectedLanguage,e.responseLanguage=f,te=await G(te,e.detectedLanguage))):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}x("none",b[f].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const X=async(e=!1)=>{if(V.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(V.log("lipsync mode is pause"),a.pause()),"stop"===e&&(V.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(V.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(V.log("lipsync mode is playing"),a.play());else{V.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[f].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[f].neededAdditionalExtension:b[f].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else V.log("lipsync mode is not set")};async function Q(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[f].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const ne=async e=>{_.detectedLanguage||(_=await J()),V.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(V.log("VideoValidator videoData: ",_),1===E&&_.detectedLanguage===f&&_.responseLanguage===f)throw b[f].VOTDisableFromYourLang;if(te.isLive)throw b[f].VOTLiveNotSupported;if(te.isPremiere)throw b[f].VOTPremiere;if(_.duration>14400)throw b[f].VOTVideoIsTooLong}return!0}(),V.log("Run translateFunc"),await ie(e,_.detectedLanguage,_.responseLanguage)};async function ae(e){V.log(`video ${e.type}`),await X(e.type)}async function oe(){await Z(),await K()}async function ie(t,o,i){console.log("VOT Video Data: ",_);const r=`${y[d]}${t}`;await async function(t,n,a,o,i){V.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),await e(t,n,a,o,((e,t)=>{if(V.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[f].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[f].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[f].translationTakeMoreThanHour:t>=10&&t%10?b[f].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[f].translationTakeAboutMinute:b[f].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[f].translationTakeFewMinutes);break;case 3:i(!1,b[f].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(V.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[f].translationTake)&&(clearTimeout(p),p=setTimeout((()=>ie(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(await oe(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&X("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ae))))),x("success",b[f].disableTranslate),await Q(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[f].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);V.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const re=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?re(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&re(document.querySelector("#player"),["mousemove","mouseout"],s):re("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelectorAll("video").forEach((e=>{e.addEventListener("abort",(async()=>{V.log("lipsync mode is abort"),await oe(),_=""}))})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(V.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return V.log("[click translationBtn] audio.src is not empty"),void await oe();try{V.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[f].VOTNoVideoIDFound;await ne(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[f].VOTNoVideoIDFound;try{await ne(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(V.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}V.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)V.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void V.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{V.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(V.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(V.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){V.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}V.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return V.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return V.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))V.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){V.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(V.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))V.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot.user.js b/dist/vot.user.js index b9f0f8e5..db9daf9b 100644 --- a/dist/vot.user.js +++ b/dist/vot.user.js @@ -2697,6 +2697,9 @@ async function src_main() { .querySelector("#VOTTranslateToLang") .addEventListener("change", async (event) => { utils_debug.log("[onchange] select to language", event.target.value); + if (!videoData) { + videoData = await getVideoData() + } await setResponseLangauge(videoData, event.target.value); }); } @@ -2921,21 +2924,9 @@ async function src_main() { // data - ytData or VideoData async function setResponseLangauge(data, resplang) { - switch (resplang) { - case "en": - data.responseLanguage = resplang; - if (lang == "ru") data.detectedLanguage = "ru"; - break; - default: - if (!Object.keys(availableLangs).includes(resplang)) { - return setResponseLangauge(data, "ru"); - } - - if (data.detectedLanguage && data.responseLanguage === lang) { - data.detectedLanguage = "en"; - } - - data.responseLanguage = resplang || lang; + data.responseLanguage = resplang; + if (!Object.keys(availableLangs).includes(resplang)) { + return setResponseLangauge(data, "ru"); } await setSelectMenuValues(data, data.detectedLanguage, data.responseLanguage); @@ -3470,6 +3461,7 @@ async function src_main() { video.addEventListener("abort", async () => { utils_debug.log("lipsync mode is abort"); await stopTranslation(); + videoData = "" }); }); diff --git a/src/index.js b/src/index.js index 3885643b..f0d9b0bc 100644 --- a/src/index.js +++ b/src/index.js @@ -309,6 +309,9 @@ async function main() { .querySelector("#VOTTranslateToLang") .addEventListener("change", async (event) => { debug.log("[onchange] select to language", event.target.value); + if (!videoData) { + videoData = await getVideoData() + } await setResponseLangauge(videoData, event.target.value); }); } @@ -552,21 +555,9 @@ async function main() { // data - ytData or VideoData async function setResponseLangauge(data, resplang) { - switch (resplang) { - case "en": - data.responseLanguage = resplang; - if (lang == "ru") data.detectedLanguage = "ru"; - break; - default: - if (!Object.keys(availableLangs).includes(resplang)) { - return setResponseLangauge(data, "ru"); - } - - if (data.detectedLanguage && data.responseLanguage === lang) { - data.detectedLanguage = "en"; - } - - data.responseLanguage = resplang || lang; + data.responseLanguage = resplang; + if (!Object.keys(availableLangs).includes(resplang)) { + return setResponseLangauge(data, "ru"); } await setSelectMenuValues(data, data.detectedLanguage, data.responseLanguage); @@ -1111,6 +1102,7 @@ async function main() { video.addEventListener("abort", async () => { debug.log("lipsync mode is abort"); await stopTranslation(); + videoData = "" }); }); From 5814efcfb85cd3f8e08a5afc08df703a98c9c2da Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Sun, 6 Aug 2023 05:31:17 +0400 Subject: [PATCH 46/48] Add files via upload --- dist/vot-cloudflare-min.user.js | 2 +- dist/vot-cloudflare.user.js | 120 +++++++++++++++++-------------- dist/vot-min.user.js | 2 +- dist/vot.user.js | 120 +++++++++++++++++-------------- src/index.js | 121 ++++++++++++++++++-------------- 5 files changed, 204 insertions(+), 161 deletions(-) diff --git a/dist/vot-cloudflare-min.user.js b/dist/vot-cloudflare-min.user.js index 1984c5e6..a27ae57d 100644 --- a/dist/vot-cloudflare-min.user.js +++ b/dist/vot-cloudflare-min.user.js @@ -84,4 +84,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],A=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],z=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,z)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...A];let ee="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,A,z,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0,$="";y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),await Y($,e.target.value)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$||($=await J()),await W($,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,A=e.dontTranslateYourLang,q=e.audioProxy,z=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",A,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),A=t,y.Z.log("dontTranslateYourLang value changed. New value: ",A)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?te():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",z,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),z=t,y.Z.log("syncVolume value changed. New value: ",z)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t,n){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${t} to ${n}`),document.querySelector("#VOTTranslateFromLang").value=t,document.querySelector("#VOTTranslateToLang").value=n,e.responseLanguage=n)}async function Y(e,t){return e.detectedLanguage=t,e.responseLanguage=b,Object.keys(v.tW).includes(t)?(await U(e,e.detectedLanguage,e.responseLanguage),e):Y(e,"en")}async function W(e,t){return e.responseLanguage=t,Object.keys(v.tW).includes(t)?(await U(e,e.detectedLanguage,e.responseLanguage),e):W(e,"ru")}async function G(){o.pause(),p.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===z&&(f=Number(e))}async function J(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(ee=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==ee.author&&(e.detectedLanguage=ee.detectedLanguage,e.responseLanguage=b,ee=await Y(ee,e.detectedLanguage))):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const X=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function te(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==z)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const ne=async e=>{$.detectedLanguage||($=await J()),y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===A&&$.detectedLanguage===b&&$.responseLanguage===b)throw v.Iz[b].VOTDisableFromYourLang;if(ee.isLive)throw v.Iz[b].VOTLiveNotSupported;if(ee.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ie(e,$.detectedLanguage,$.responseLanguage)};async function oe(e){y.Z.log(`video ${e.type}`),await X(e.type)}async function ae(){await G(),await K()}async function ie(t,a,i){console.log("VOT Video Data: ",$);const s=`${v.g$[u]}${t}`;await async function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,await e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(s,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ie(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",ae);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,ae)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(await ae(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&X("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,oe))))),O("success",v.Iz[b].disableTranslate),await te(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===z&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const re=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?re(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&re(document.querySelector("#player"),["mousemove","mouseout"],l):re("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelectorAll("video").forEach((e=>{e.addEventListener("abort",(async()=>{y.Z.log("lipsync mode is abort"),await ae(),$=""}))})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await ae();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await ne(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await ne(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(A.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],A=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],z=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,z)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...A];let ee=b,te="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,A,z,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0,$="";y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),$=await G(),await U(e.target.value,$.responseLanguage)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await G(),await U($.detectedLanguage,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,A=e.dontTranslateYourLang,q=e.audioProxy,z=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",A,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),A=t,y.Z.log("dontTranslateYourLang value changed. New value: ",A)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?J():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",z,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),z=t,y.Z.log("syncVolume value changed. New value: ",z)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,console.log(`Set translation from ${e} to ${t}`),$.detectedLanguage=e,$.responseLanguage=t,console.log("VOT GOVNO",e,t))}async function Y(){o.pause(),p.removeEventListener(".translate",Y,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function W(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===z&&(f=Number(e))}async function G(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage=ee,window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==te.author&&(e.detectedLanguage=te.detectedLanguage,e.responseLanguage=b)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&W()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const K=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function J(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==z)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const X=async e=>{$.detectedLanguage||($=await G(),await U($.detectedLanguage,$.responseLanguage)),y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===A&&$.detectedLanguage===b&&$.responseLanguage===b)throw v.Iz[b].VOTDisableFromYourLang;if(te.isLive)throw v.Iz[b].VOTLiveNotSupported;if(te.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await K(e.type)}async function oe(){await Y(),await W()}async function ae(t,a,i){console.log("VOT Video Data: ",$),function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(`${v.g$[u]}${t}`,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&K("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await J(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===z&&function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelectorAll("video").forEach((e=>{e.addEventListener("abort",(async()=>{y.Z.log("lipsync mode is abort"),await oe(),$=""}))})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await Y();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await X(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await X(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(A.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot-cloudflare.user.js b/dist/vot-cloudflare.user.js index 2ad0ae85..edecaf53 100644 --- a/dist/vot-cloudflare.user.js +++ b/dist/vot-cloudflare.user.js @@ -2481,7 +2481,7 @@ const sitesChromiumBlocked = [...sitesInvidious, ...sitesPiped]; // translate properties let translateFromLang = "en"; // default language of video -let translateToLang = "ru"; // default language of audio response +let translateToLang = lang; // default language of audio response let ytData = ""; @@ -2572,13 +2572,7 @@ async function src_main() { debug/* default */.Z.log("VOT: Added translation menu to ", element); } - async function translateVideo( - url, - unknown1, - requestLang, - responseLang, - callback - ) { + function translateVideo(url, unknown1, requestLang, responseLang, callback) { debug/* default */.Z.log( `Translate video (url: ${url}, unknown1: ${unknown1}, requestLang: ${requestLang}, responseLang: ${responseLang})` ); @@ -2590,7 +2584,7 @@ async function src_main() { translationPanding = true; - await requestVideoTranslation( + requestVideoTranslation( url, unknown1, requestLang, @@ -2742,17 +2736,16 @@ async function src_main() { .querySelector("#VOTTranslateFromLang") .addEventListener("change", async (event) => { debug/* default */.Z.log("[onchange] select from language", event.target.value); - await setDetectedLangauge(videoData, event.target.value); + videoData = await getVideoData() + await setSelectMenuValues(event.target.value, videoData.responseLanguage); }); menuOptions .querySelector("#VOTTranslateToLang") .addEventListener("change", async (event) => { debug/* default */.Z.log("[onchange] select to language", event.target.value); - if (!videoData) { - videoData = await getVideoData() - } - await setResponseLangauge(videoData, event.target.value); + videoData = await getVideoData() + await setSelectMenuValues(videoData.detectedLanguage, event.target.value); }); } @@ -2969,41 +2962,66 @@ async function src_main() { }); } - async function setSelectMenuValues(videoData, from, to) { - const selectLanguages = document.querySelector("#VOTSelectLanguages"); - if (!selectLanguages) { + async function setSelectMenuValues(from, to) { + if (!document.querySelector("#VOTSelectLanguages")) { return; } - console.log(`Set translation from ${from} to ${to}`); document.querySelector("#VOTTranslateFromLang").value = from; document.querySelector("#VOTTranslateToLang").value = to; - videoData.responseLanguage = to; + console.log(`Set translation from ${from} to ${to}`); + videoData.detectedLanguage = from + videoData.responseLanguage = to + console.log("VOT GOVNO", from, to) } // data - ytData or VideoData - async function setDetectedLangauge(data, videolang) { - data.detectedLanguage = videolang; - data.responseLanguage = lang; - if (!Object.keys(constants/* availableLangs */.tW).includes(videolang)) { - return setDetectedLangauge(data, "en"); - } + // async function setDetectedLangauge(data, videolang) { + // switch (videolang) { + // case "en": + // data.detectedLanguage = videolang; + // data.responseLanguage = lang; + // break; + // case "ru": + // data.detectedLanguage = videolang; + // data.responseLanguage = lang; + // if (lang == "ru") data.responseLanguage = "en"; + // break; + // default: + // if (!Object.keys(availableLangs).includes(videolang)) { + // return setDetectedLangauge(data, "en"); + // } + + // data.detectedLanguage = videolang; + // } + + // setSelectMenuValues(data.detectedLanguage, data.responseLanguage); + + // return data; + // } - await setSelectMenuValues(data, data.detectedLanguage, data.responseLanguage); + // data - ytData or VideoData + // async function setResponseLangauge(data, videolang) { + // switch (videolang) { + // case "en": + // data.responseLanguage = videolang; + // data.detectedLanguage = "ru"; + // break; + // default: + // if (!Object.keys(availableLangs).includes(videolang)) { + // return setResponseLangauge(data, "ru"); + // } - return data; - } + // if (data.detectedLanguage && data.responseLanguage === lang) { + // data.detectedLanguage = "en"; + // } - // data - ytData or VideoData - async function setResponseLangauge(data, resplang) { - data.responseLanguage = resplang; - if (!Object.keys(constants/* availableLangs */.tW).includes(resplang)) { - return setResponseLangauge(data, "ru"); - } + // data.responseLanguage = videolang; + // } - await setSelectMenuValues(data, data.detectedLanguage, data.responseLanguage); + // setSelectMenuValues(data.detectedLanguage, data.responseLanguage); - return data; - } + // return data; + // } async function stopTraslate() { // Default actions on stop translate @@ -3061,7 +3079,6 @@ async function src_main() { if (ytData.author !== "") { videoData.detectedLanguage = ytData.detectedLanguage; videoData.responseLanguage = lang; - ytData = await setDetectedLangauge(ytData, videoData.detectedLanguage); } } else if ( window.location.hostname.includes("rutube") || @@ -3234,7 +3251,7 @@ async function src_main() { // Sync translation volume with video volume if dbSyncVolume is 1 if (dbSyncVolume === 1) { - await syncTranslationWithVideo(value); + syncTranslationWithVideo(value); } }; @@ -3244,7 +3261,7 @@ async function src_main() { } // A helper function to sync translation volume with video volume - async function syncTranslationWithVideo(translationValue) { + function syncTranslationWithVideo(translationValue) { // Get the video volume slider element const videoVolumeSlider = document.querySelector("#VOTVideoSlider"); @@ -3300,7 +3317,10 @@ async function src_main() { } const translateExecutor = async (VIDEO_ID) => { - if (!videoData.detectedLanguage) videoData = await getVideoData() + if (!videoData.detectedLanguage) { + videoData = await getVideoData() + await setSelectMenuValues(videoData.detectedLanguage, videoData.responseLanguage); + } debug/* default */.Z.log("Run videoValidator"); await videoValidator(); debug/* default */.Z.log("Run translateFunc"); @@ -3327,7 +3347,7 @@ async function src_main() { async function translateFunc(VIDEO_ID, requestLang, responseLang) { console.log("VOT Video Data: ", videoData); const videoURL = `${constants/* siteTranslates */.g$[siteHostname]}${VIDEO_ID}`; - await translateVideo( + translateVideo( videoURL, constants/* translateFuncParam */.ey, requestLang, @@ -3412,7 +3432,7 @@ async function src_main() { mutation.target === video && mutation.target.src !== "" ) { - await stopTranslation(); + stopTranslation(); firstPlay = true; } }); @@ -3434,6 +3454,7 @@ async function src_main() { "playing", "ratechange", "play", + "abort", "waiting", "pause", ]; @@ -3533,11 +3554,6 @@ async function src_main() { document.addEventListener("touchend", (event) => changeOpacityOnEvent(event, timer, opacityRatio) ); - // Возможно лишнее - // window.addEventListener("popstate", async function () { - // await stopTranslation() - // debug.log("popstate triggered") - // }); document.querySelectorAll("video").forEach(video => { video.addEventListener("abort", async () => { debug/* default */.Z.log("lipsync mode is abort"); @@ -3545,7 +3561,6 @@ async function src_main() { videoData = "" }); }); - document .querySelector(".translationBtn") @@ -3557,7 +3572,7 @@ async function src_main() { // check if the audio source is not empty if (audio.src) { debug/* default */.Z.log("[click translationBtn] audio.src is not empty"); - await stopTranslation(); + await stopTraslate(); return; } @@ -3632,7 +3647,7 @@ async function src_main() { document.addEventListener("spfdone", ytPageEnter); document.addEventListener("yt-navigate-finish", ytPageEnter); - const ytPageLeave = async () => { + const ytPageLeave = () => { document.body.dispatchEvent(new Event("yt-translate-stop")); }; @@ -3669,7 +3684,7 @@ async function src_main() { attributeOldValue: true, }); } - const ytPageLeave = async () => { + const ytPageLeave = () => { document.body.dispatchEvent(new Event("yt-translate-stop")); }; document.addEventListener("spfdone", ytPageLeave); @@ -3904,7 +3919,6 @@ async function src_main() { src_main().catch((e) => { console.error(e); }); - })(); /******/ })() diff --git a/dist/vot-min.user.js b/dist/vot-min.user.js index fa0abfeb..1c4fba22 100644 --- a/dist/vot-min.user.js +++ b/dist/vot-min.user.js @@ -83,4 +83,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var a=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),o=n.n(a),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(o());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(a)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,o&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>o,IM:()=>r,Rr:()=>i,iF:()=>a});const a="api.browser.yandex.ru",o="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function a(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var o=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=a(!0),d=o.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),o=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":o,"Sec-Vtrans-Token":a(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const a=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),o=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(a).add(o),r={encodeRequest:(e,t,n,a,o)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:a,unknown3:0,unknown4:0,responseLanguage:o}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),a=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),o=n.n(a),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,a,o){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,a,o].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=o(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},V={log:(...e)=>{},translations:e=>{}};let f=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="checkbox",o.id=e,o.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(o),a.appendChild(i),a}function L(e,t,n){const a=document.createElement("div"),o=document.createElement("input"),i=document.createElement("label");return o.type="range",o.id=e,o.classList.add("VOTMenuSlider"),o.min=0,o.max=100,o.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,a.classList.add("translationMenuContainer"),a.appendChild(i),a.appendChild(o),a}function F(e,t){const n=document.createElement("div"),a=document.createElement("select");a.id=e,a.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),a.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(a),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const a=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),a.disconnect())}));a.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}f in b||(f="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[f].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=a=>{const o=n.result;if(o.onerror=()=>{const e=b[f].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},a.oldVersion<1){const n=o.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const a=o.transaction("settings","readwrite").objectStore("settings").add(B);a.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",a.result),e(!0)},a.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",a.error),t(!1)}}}a.oldVersion<2&&function(n,a,o,i={}){const r=n.objectStore("settings");for(const e of Object.keys(o))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=a.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in o)n[e]=o[e];const a=r.put(n);a.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},a.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,o,z)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[f].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,a=b[f].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:a,autoSetVolumeYandexStyle:o,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof a||"number"==typeof o||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[f].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof a&&(d.syncVolume=a),"number"==typeof o&&(d.autoSetVolumeYandexStyle=o),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[f].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,a){let o;return t>a?(o=n+(t-a),o=o>100?100:Math.max(o,0),e.volume=o/100):t100?100:Math.max(o,0),e.volume=o/100),o}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te="";(async function(){V.log("Loading extension..."),V.log(`Selected menu language: ${f}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(V.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[f].unSupportedExtensionError;return console.error(e),alert(e)}let t;V.log("Extension compatibility passed...");const a=new Audio;let o=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;V.log("[translateProccessor] execute on element: ",n);let B,z=!0,_="";V.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),V.log("video",c);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[f].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),V.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[f].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=o,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),V.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[f].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[f][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[f].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[f][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),a=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(a),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{V.log("[onchange] select from language",e.target.value),await G(_,e.target.value)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{V.log("[onchange] select to language",e.target.value),_||(_=await J()),await W(_,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[f].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const a=n.result;a.onversionchange=()=>{a.close();const e=b[f].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const o=a.transaction("settings").objectStore("settings").get("settings");o.onerror=e=>{console.error(b[f].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},o.onsuccess=()=>{void 0===o.result&&(a.close(),j(),t(!1));const n=o.result;e(n)}},n.onblocked=()=>{const e=n.result,a=b[f].VOTDisabledForDBUpdating;console.error(a,e),alert(a),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,V.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[f].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[f].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,V.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[f].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,V.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[f].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,V.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[f].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,V.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?Q():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[f].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,V.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t,n){document.querySelector("#VOTSelectLanguages")&&(console.log(`Set translation from ${t} to ${n}`),document.querySelector("#VOTTranslateFromLang").value=t,document.querySelector("#VOTTranslateToLang").value=n,e.responseLanguage=n)}async function G(e,t){return e.detectedLanguage=t,e.responseLanguage=f,Object.keys(v).includes(t)?(await Y(e,e.detectedLanguage,e.responseLanguage),e):G(e,"en")}async function W(e,t){return e.responseLanguage=t,Object.keys(v).includes(t)?(await Y(e,e.detectedLanguage,e.responseLanguage),e):W(e,"ru")}async function Z(){a.pause(),c.removeEventListener(".translate",Z,!1),await(async()=>{a.src="",a.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[f].translateVideo),m&&(c.volume=m)}async function K(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}async function J(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage="ru",window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:a,isPremiere:o,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:a,isPremiere:o,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==te.author&&(e.detectedLanguage=te.detectedLanguage,e.responseLanguage=f,te=await G(te,e.detectedLanguage))):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}x("none",b[f].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&K()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const X=async(e=!1)=>{if(V.log("lipsync video",c),c)if(a.currentTime=c.currentTime,a.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(V.log("lipsync mode is pause"),a.pause()),"stop"===e&&(V.log("lipsync mode is stop"),a.pause()),"waiting"===e&&(V.log("lipsync mode is waiting"),a.pause()),"playing"===e&&(V.log("lipsync mode is playing"),a.play());else{V.log("lipsync mode is play");const e=a.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[f].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[f].neededAdditionalExtension:b[f].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else V.log("lipsync mode is not set")};async function Q(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[f].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const o=document.querySelector("#VOTTranslationSlider");if(!o)return;const i=Number(o.value),r=$(a,n,i,g);o.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const ne=async e=>{_.detectedLanguage||(_=await J()),V.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(V.log("VideoValidator videoData: ",_),1===E&&_.detectedLanguage===f&&_.responseLanguage===f)throw b[f].VOTDisableFromYourLang;if(te.isLive)throw b[f].VOTLiveNotSupported;if(te.isPremiere)throw b[f].VOTPremiere;if(_.duration>14400)throw b[f].VOTVideoIsTooLong}return!0}(),V.log("Run translateFunc"),await ie(e,_.detectedLanguage,_.responseLanguage)};async function ae(e){V.log(`video ${e.type}`),await X(e.type)}async function oe(){await Z(),await K()}async function ie(t,o,i){console.log("VOT Video Data: ",_);const r=`${y[d]}${t}`;await async function(t,n,a,o,i){V.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${a}, responseLang: ${o})`),await e(t,n,a,o,((e,t)=>{if(V.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[f].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[f].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[f].translationTakeMoreThanHour:t>=10&&t%10?b[f].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[f].translationTakeAboutMinute:b[f].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[f].translationTakeFewMinutes);break;case 3:i(!1,b[f].videoBeingTranslated)}}))}(r,0x4075500000000000,o,i,(async(e,r)=>{if(V.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[f].translationTake)&&(clearTimeout(p),p=setTimeout((()=>ie(t,o,i)),6e4)),r;switch(a.src=r,m=c?.volume,"number"==typeof S&&(a.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(await oe(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&X("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,ae))))),x("success",b[f].disableTranslate),await Q(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[f].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{a.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&await async function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),a=$(c,e,n,w);t.value=a;const o=document.querySelector("#VOTOriginalVolume");o&&(o.innerText=`${a}%`),g=a,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),a=document.querySelector(".translationMenuContent"),o=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!a&&e.target!==a)&&a.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);V.log(`[document click] ${o} ${s} ${l}`),o||s||(l||r(0),a.style.display="none",i=!1)}));const re=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?re(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&re(document.querySelector("#player"),["mousemove","mouseout"],s):re("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,o))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,o))),document.addEventListener("touchstart",(e=>l(e,t,o))),document.addEventListener("touchmove",(e=>l(e,t,o))),document.addEventListener("touchend",(e=>l(e,t,o))),document.querySelectorAll("video").forEach((e=>{e.addEventListener("abort",(async()=>{V.log("lipsync mode is abort"),await oe(),_=""}))})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(V.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),a.src)return V.log("[click translationBtn] audio.src is not empty"),void await oe();try{V.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[f].VOTNoVideoIDFound;await ne(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[f].VOTNoVideoIDFound;try{await ne(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(V.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}V.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)V.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void V.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{V.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=async()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(V.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(V.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){V.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}V.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return V.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return V.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))V.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){V.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(V.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))V.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>a,IM:()=>r,Rr:()=>i,iF:()=>o});const o="api.browser.yandex.ru",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var a=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=o(!0),d=a.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},V={log:(...e)=>{},translations:e=>{}};let f=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function L(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function F(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}f in b||(f="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[f].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=b[f].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(B);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,z)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=b[f].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=b[f].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[f].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[f].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te=f,ne="";(async function(){V.log("Loading extension..."),V.log(`Selected menu language: ${f}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(V.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[f].unSupportedExtensionError;return console.error(e),alert(e)}let t;V.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;V.log("[translateProccessor] execute on element: ",n);let B,z=!0,_="";V.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),V.log("video",c);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[f].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),V.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[f].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),V.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[f].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[f][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[f].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[f][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),o=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{V.log("[onchange] select from language",e.target.value),_=await Z(),await Y(e.target.value,_.responseLanguage)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{V.log("[onchange] select to language",e.target.value),_=await Z(),await Y(_.detectedLanguage,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[f].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=b[f].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(b[f].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),j(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=b[f].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,V.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[f].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[f].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,V.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[f].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,V.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[f].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,V.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[f].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,V.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?J():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[f].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,V.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,console.log(`Set translation from ${e} to ${t}`),_.detectedLanguage=e,_.responseLanguage=t,console.log("VOT GOVNO",e,t))}async function G(){o.pause(),c.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[f].translateVideo),m&&(c.volume=m)}async function W(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}async function Z(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage=te,window.location.hostname.includes("youtube.com")?(ne=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==ne.author&&(e.detectedLanguage=ne.detectedLanguage,e.responseLanguage=f)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}x("none",b[f].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&W()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const K=async(e=!1)=>{if(V.log("lipsync video",c),c)if(o.currentTime=c.currentTime,o.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(V.log("lipsync mode is pause"),o.pause()),"stop"===e&&(V.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(V.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(V.log("lipsync mode is playing"),o.play());else{V.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[f].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[f].neededAdditionalExtension:b[f].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else V.log("lipsync mode is not set")};async function J(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[f].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=$(o,n,i,g);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const X=async e=>{_.detectedLanguage||(_=await Z(),await Y(_.detectedLanguage,_.responseLanguage)),V.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(V.log("VideoValidator videoData: ",_),1===E&&_.detectedLanguage===f&&_.responseLanguage===f)throw b[f].VOTDisableFromYourLang;if(ne.isLive)throw b[f].VOTLiveNotSupported;if(ne.isPremiere)throw b[f].VOTPremiere;if(_.duration>14400)throw b[f].VOTVideoIsTooLong}return!0}(),V.log("Run translateFunc"),await ae(e,_.detectedLanguage,_.responseLanguage)};async function Q(e){V.log(`video ${e.type}`),await K(e.type)}async function oe(){await G(),await W()}async function ae(t,a,i){console.log("VOT Video Data: ",_),function(t,n,o,a,i){V.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),e(t,n,o,a,((e,t)=>{if(V.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[f].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[f].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[f].translationTakeMoreThanHour:t>=10&&t%10?b[f].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[f].translationTakeAboutMinute:b[f].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[f].translationTakeFewMinutes);break;case 3:i(!1,b[f].videoBeingTranslated)}}))}(`${y[d]}${t}`,0x4075500000000000,a,i,(async(e,r)=>{if(V.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[f].translationTake)&&(clearTimeout(p),p=setTimeout((()=>ae(t,a,i)),6e4)),r;switch(o.src=r,m=c?.volume,"number"==typeof S&&(o.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(oe(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&K("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,Q))))),x("success",b[f].disableTranslate),await J(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[f].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=$(c,e,n,w);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),g=o,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);V.log(`[document click] ${a} ${s} ${l}`),a||s||(l||r(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,a))),document.addEventListener("touchstart",(e=>l(e,t,a))),document.addEventListener("touchmove",(e=>l(e,t,a))),document.addEventListener("touchend",(e=>l(e,t,a))),document.querySelectorAll("video").forEach((e=>{e.addEventListener("abort",(async()=>{V.log("lipsync mode is abort"),await oe(),_=""}))})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(V.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return V.log("[click translationBtn] audio.src is not empty"),void await G();try{V.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[f].VOTNoVideoIDFound;await X(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[f].VOTNoVideoIDFound;try{await X(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(V.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}V.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)V.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void V.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{V.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(V.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(V.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){V.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}V.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return V.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return V.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))V.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){V.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(V.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))V.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot.user.js b/dist/vot.user.js index db9daf9b..d21fb6cb 100644 --- a/dist/vot.user.js +++ b/dist/vot.user.js @@ -2426,7 +2426,7 @@ const sitesChromiumBlocked = [...sitesInvidious, ...sitesPiped]; // translate properties let translateFromLang = "en"; // default language of video -let translateToLang = "ru"; // default language of audio response +let translateToLang = lang; // default language of audio response let ytData = ""; @@ -2523,13 +2523,7 @@ async function src_main() { utils_debug.log("VOT: Added translation menu to ", element); } - async function translateVideo( - url, - unknown1, - requestLang, - responseLang, - callback - ) { + function translateVideo(url, unknown1, requestLang, responseLang, callback) { utils_debug.log( `Translate video (url: ${url}, unknown1: ${unknown1}, requestLang: ${requestLang}, responseLang: ${responseLang})` ); @@ -2538,7 +2532,7 @@ async function src_main() { translationPanding = true; - await requestVideoTranslation( + requestVideoTranslation( url, unknown1, requestLang, @@ -2690,17 +2684,16 @@ async function src_main() { .querySelector("#VOTTranslateFromLang") .addEventListener("change", async (event) => { utils_debug.log("[onchange] select from language", event.target.value); - await setDetectedLangauge(videoData, event.target.value); + videoData = await getVideoData() + await setSelectMenuValues(event.target.value, videoData.responseLanguage); }); menuOptions .querySelector("#VOTTranslateToLang") .addEventListener("change", async (event) => { utils_debug.log("[onchange] select to language", event.target.value); - if (!videoData) { - videoData = await getVideoData() - } - await setResponseLangauge(videoData, event.target.value); + videoData = await getVideoData() + await setSelectMenuValues(videoData.detectedLanguage, event.target.value); }); } @@ -2898,41 +2891,66 @@ async function src_main() { }); } - async function setSelectMenuValues(videoData, from, to) { - const selectLanguages = document.querySelector("#VOTSelectLanguages"); - if (!selectLanguages) { + async function setSelectMenuValues(from, to) { + if (!document.querySelector("#VOTSelectLanguages")) { return; } - console.log(`Set translation from ${from} to ${to}`); document.querySelector("#VOTTranslateFromLang").value = from; document.querySelector("#VOTTranslateToLang").value = to; - videoData.responseLanguage = to; + console.log(`Set translation from ${from} to ${to}`); + videoData.detectedLanguage = from + videoData.responseLanguage = to + console.log("VOT GOVNO", from, to) } // data - ytData or VideoData - async function setDetectedLangauge(data, videolang) { - data.detectedLanguage = videolang; - data.responseLanguage = lang; - if (!Object.keys(availableLangs).includes(videolang)) { - return setDetectedLangauge(data, "en"); - } + // async function setDetectedLangauge(data, videolang) { + // switch (videolang) { + // case "en": + // data.detectedLanguage = videolang; + // data.responseLanguage = lang; + // break; + // case "ru": + // data.detectedLanguage = videolang; + // data.responseLanguage = lang; + // if (lang == "ru") data.responseLanguage = "en"; + // break; + // default: + // if (!Object.keys(availableLangs).includes(videolang)) { + // return setDetectedLangauge(data, "en"); + // } + + // data.detectedLanguage = videolang; + // } + + // setSelectMenuValues(data.detectedLanguage, data.responseLanguage); + + // return data; + // } - await setSelectMenuValues(data, data.detectedLanguage, data.responseLanguage); + // data - ytData or VideoData + // async function setResponseLangauge(data, videolang) { + // switch (videolang) { + // case "en": + // data.responseLanguage = videolang; + // data.detectedLanguage = "ru"; + // break; + // default: + // if (!Object.keys(availableLangs).includes(videolang)) { + // return setResponseLangauge(data, "ru"); + // } - return data; - } + // if (data.detectedLanguage && data.responseLanguage === lang) { + // data.detectedLanguage = "en"; + // } - // data - ytData or VideoData - async function setResponseLangauge(data, resplang) { - data.responseLanguage = resplang; - if (!Object.keys(availableLangs).includes(resplang)) { - return setResponseLangauge(data, "ru"); - } + // data.responseLanguage = videolang; + // } - await setSelectMenuValues(data, data.detectedLanguage, data.responseLanguage); + // setSelectMenuValues(data.detectedLanguage, data.responseLanguage); - return data; - } + // return data; + // } async function stopTraslate() { // Default actions on stop translate @@ -2990,7 +3008,6 @@ async function src_main() { if (ytData.author !== "") { videoData.detectedLanguage = ytData.detectedLanguage; videoData.responseLanguage = lang; - ytData = await setDetectedLangauge(ytData, videoData.detectedLanguage); } } else if ( window.location.hostname.includes("rutube") || @@ -3163,7 +3180,7 @@ async function src_main() { // Sync translation volume with video volume if dbSyncVolume is 1 if (dbSyncVolume === 1) { - await syncTranslationWithVideo(value); + syncTranslationWithVideo(value); } }; @@ -3173,7 +3190,7 @@ async function src_main() { } // A helper function to sync translation volume with video volume - async function syncTranslationWithVideo(translationValue) { + function syncTranslationWithVideo(translationValue) { // Get the video volume slider element const videoVolumeSlider = document.querySelector("#VOTVideoSlider"); @@ -3229,7 +3246,10 @@ async function src_main() { } const translateExecutor = async (VIDEO_ID) => { - if (!videoData.detectedLanguage) videoData = await getVideoData() + if (!videoData.detectedLanguage) { + videoData = await getVideoData() + await setSelectMenuValues(videoData.detectedLanguage, videoData.responseLanguage); + } utils_debug.log("Run videoValidator"); await videoValidator(); utils_debug.log("Run translateFunc"); @@ -3256,7 +3276,7 @@ async function src_main() { async function translateFunc(VIDEO_ID, requestLang, responseLang) { console.log("VOT Video Data: ", videoData); const videoURL = `${siteTranslates[siteHostname]}${VIDEO_ID}`; - await translateVideo( + translateVideo( videoURL, translateFuncParam, requestLang, @@ -3331,7 +3351,7 @@ async function src_main() { mutation.target === video && mutation.target.src !== "" ) { - await stopTranslation(); + stopTranslation(); firstPlay = true; } }); @@ -3353,6 +3373,7 @@ async function src_main() { "playing", "ratechange", "play", + "abort", "waiting", "pause", ]; @@ -3452,11 +3473,6 @@ async function src_main() { document.addEventListener("touchend", (event) => changeOpacityOnEvent(event, timer, opacityRatio) ); - // Возможно лишнее - // window.addEventListener("popstate", async function () { - // await stopTranslation() - // debug.log("popstate triggered") - // }); document.querySelectorAll("video").forEach(video => { video.addEventListener("abort", async () => { utils_debug.log("lipsync mode is abort"); @@ -3464,7 +3480,6 @@ async function src_main() { videoData = "" }); }); - document .querySelector(".translationBtn") @@ -3476,7 +3491,7 @@ async function src_main() { // check if the audio source is not empty if (audio.src) { utils_debug.log("[click translationBtn] audio.src is not empty"); - await stopTranslation(); + await stopTraslate(); return; } @@ -3551,7 +3566,7 @@ async function src_main() { document.addEventListener("spfdone", ytPageEnter); document.addEventListener("yt-navigate-finish", ytPageEnter); - const ytPageLeave = async () => { + const ytPageLeave = () => { document.body.dispatchEvent(new Event("yt-translate-stop")); }; @@ -3588,7 +3603,7 @@ async function src_main() { attributeOldValue: true, }); } - const ytPageLeave = async () => { + const ytPageLeave = () => { document.body.dispatchEvent(new Event("yt-translate-stop")); }; document.addEventListener("spfdone", ytPageLeave); @@ -3823,7 +3838,6 @@ async function src_main() { src_main().catch((e) => { console.error(e); }); - })(); /******/ })() diff --git a/src/index.js b/src/index.js index f0d9b0bc..7f7a9d14 100644 --- a/src/index.js +++ b/src/index.js @@ -31,7 +31,7 @@ const sitesChromiumBlocked = [...sitesInvidious, ...sitesPiped]; // translate properties let translateFromLang = "en"; // default language of video -let translateToLang = "ru"; // default language of audio response +let translateToLang = lang; // default language of audio response let ytData = ""; @@ -132,13 +132,7 @@ async function main() { debug.log("VOT: Added translation menu to ", element); } - async function translateVideo( - url, - unknown1, - requestLang, - responseLang, - callback - ) { + function translateVideo(url, unknown1, requestLang, responseLang, callback) { debug.log( `Translate video (url: ${url}, unknown1: ${unknown1}, requestLang: ${requestLang}, responseLang: ${responseLang})` ); @@ -150,7 +144,7 @@ async function main() { translationPanding = true; - await requestVideoTranslation( + requestVideoTranslation( url, unknown1, requestLang, @@ -302,17 +296,16 @@ async function main() { .querySelector("#VOTTranslateFromLang") .addEventListener("change", async (event) => { debug.log("[onchange] select from language", event.target.value); - await setDetectedLangauge(videoData, event.target.value); + videoData = await getVideoData() + await setSelectMenuValues(event.target.value, videoData.responseLanguage); }); menuOptions .querySelector("#VOTTranslateToLang") .addEventListener("change", async (event) => { debug.log("[onchange] select to language", event.target.value); - if (!videoData) { - videoData = await getVideoData() - } - await setResponseLangauge(videoData, event.target.value); + videoData = await getVideoData() + await setSelectMenuValues(videoData.detectedLanguage, event.target.value); }); } @@ -529,41 +522,66 @@ async function main() { }); } - async function setSelectMenuValues(videoData, from, to) { - const selectLanguages = document.querySelector("#VOTSelectLanguages"); - if (!selectLanguages) { + async function setSelectMenuValues(from, to) { + if (!document.querySelector("#VOTSelectLanguages")) { return; } - console.log(`Set translation from ${from} to ${to}`); document.querySelector("#VOTTranslateFromLang").value = from; document.querySelector("#VOTTranslateToLang").value = to; - videoData.responseLanguage = to; + console.log(`Set translation from ${from} to ${to}`); + videoData.detectedLanguage = from + videoData.responseLanguage = to + console.log("VOT GOVNO", from, to) } // data - ytData or VideoData - async function setDetectedLangauge(data, videolang) { - data.detectedLanguage = videolang; - data.responseLanguage = lang; - if (!Object.keys(availableLangs).includes(videolang)) { - return setDetectedLangauge(data, "en"); - } + // async function setDetectedLangauge(data, videolang) { + // switch (videolang) { + // case "en": + // data.detectedLanguage = videolang; + // data.responseLanguage = lang; + // break; + // case "ru": + // data.detectedLanguage = videolang; + // data.responseLanguage = lang; + // if (lang == "ru") data.responseLanguage = "en"; + // break; + // default: + // if (!Object.keys(availableLangs).includes(videolang)) { + // return setDetectedLangauge(data, "en"); + // } + + // data.detectedLanguage = videolang; + // } + + // setSelectMenuValues(data.detectedLanguage, data.responseLanguage); + + // return data; + // } - await setSelectMenuValues(data, data.detectedLanguage, data.responseLanguage); + // data - ytData or VideoData + // async function setResponseLangauge(data, videolang) { + // switch (videolang) { + // case "en": + // data.responseLanguage = videolang; + // data.detectedLanguage = "ru"; + // break; + // default: + // if (!Object.keys(availableLangs).includes(videolang)) { + // return setResponseLangauge(data, "ru"); + // } - return data; - } + // if (data.detectedLanguage && data.responseLanguage === lang) { + // data.detectedLanguage = "en"; + // } - // data - ytData or VideoData - async function setResponseLangauge(data, resplang) { - data.responseLanguage = resplang; - if (!Object.keys(availableLangs).includes(resplang)) { - return setResponseLangauge(data, "ru"); - } + // data.responseLanguage = videolang; + // } - await setSelectMenuValues(data, data.detectedLanguage, data.responseLanguage); + // setSelectMenuValues(data.detectedLanguage, data.responseLanguage); - return data; - } + // return data; + // } async function stopTraslate() { // Default actions on stop translate @@ -621,7 +639,6 @@ async function main() { if (ytData.author !== "") { videoData.detectedLanguage = ytData.detectedLanguage; videoData.responseLanguage = lang; - ytData = await setDetectedLangauge(ytData, videoData.detectedLanguage); } } else if ( window.location.hostname.includes("rutube") || @@ -794,7 +811,7 @@ async function main() { // Sync translation volume with video volume if dbSyncVolume is 1 if (dbSyncVolume === 1) { - await syncTranslationWithVideo(value); + syncTranslationWithVideo(value); } }; @@ -804,7 +821,7 @@ async function main() { } // A helper function to sync translation volume with video volume - async function syncTranslationWithVideo(translationValue) { + function syncTranslationWithVideo(translationValue) { // Get the video volume slider element const videoVolumeSlider = document.querySelector("#VOTVideoSlider"); @@ -860,7 +877,10 @@ async function main() { } const translateExecutor = async (VIDEO_ID) => { - if (!videoData.detectedLanguage) videoData = await getVideoData() + if (!videoData.detectedLanguage) { + videoData = await getVideoData() + await setSelectMenuValues(videoData.detectedLanguage, videoData.responseLanguage); + } debug.log("Run videoValidator"); await videoValidator(); debug.log("Run translateFunc"); @@ -887,7 +907,7 @@ async function main() { async function translateFunc(VIDEO_ID, requestLang, responseLang) { console.log("VOT Video Data: ", videoData); const videoURL = `${siteTranslates[siteHostname]}${VIDEO_ID}`; - await translateVideo( + translateVideo( videoURL, translateFuncParam, requestLang, @@ -972,7 +992,7 @@ async function main() { mutation.target === video && mutation.target.src !== "" ) { - await stopTranslation(); + stopTranslation(); firstPlay = true; } }); @@ -994,6 +1014,7 @@ async function main() { "playing", "ratechange", "play", + "abort", "waiting", "pause", ]; @@ -1093,11 +1114,6 @@ async function main() { document.addEventListener("touchend", (event) => changeOpacityOnEvent(event, timer, opacityRatio) ); - // Возможно лишнее - // window.addEventListener("popstate", async function () { - // await stopTranslation() - // debug.log("popstate triggered") - // }); document.querySelectorAll("video").forEach(video => { video.addEventListener("abort", async () => { debug.log("lipsync mode is abort"); @@ -1105,7 +1121,6 @@ async function main() { videoData = "" }); }); - document .querySelector(".translationBtn") @@ -1117,7 +1132,7 @@ async function main() { // check if the audio source is not empty if (audio.src) { debug.log("[click translationBtn] audio.src is not empty"); - await stopTranslation(); + await stopTraslate(); return; } @@ -1192,7 +1207,7 @@ async function main() { document.addEventListener("spfdone", ytPageEnter); document.addEventListener("yt-navigate-finish", ytPageEnter); - const ytPageLeave = async () => { + const ytPageLeave = () => { document.body.dispatchEvent(new Event("yt-translate-stop")); }; @@ -1229,7 +1244,7 @@ async function main() { attributeOldValue: true, }); } - const ytPageLeave = async () => { + const ytPageLeave = () => { document.body.dispatchEvent(new Event("yt-translate-stop")); }; document.addEventListener("spfdone", ytPageLeave); @@ -1463,4 +1478,4 @@ async function main() { main().catch((e) => { console.error(e); -}); +}); \ No newline at end of file From 77e976129d297c6464ac7692db021ccd728ebaa7 Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Sun, 6 Aug 2023 05:33:12 +0400 Subject: [PATCH 47/48] Add files via upload --- dist/vot-cloudflare-min.user.js | 2 +- dist/vot-cloudflare.user.js | 1 - dist/vot-min.user.js | 2 +- dist/vot.user.js | 1 - src/index.js | 1 - 5 files changed, 2 insertions(+), 5 deletions(-) diff --git a/dist/vot-cloudflare-min.user.js b/dist/vot-cloudflare-min.user.js index a27ae57d..cf628604 100644 --- a/dist/vot-cloudflare-min.user.js +++ b/dist/vot-cloudflare-min.user.js @@ -84,4 +84,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],A=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],z=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,z)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...A];let ee=b,te="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,A,z,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0,$="";y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),$=await G(),await U(e.target.value,$.responseLanguage)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await G(),await U($.detectedLanguage,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,A=e.dontTranslateYourLang,q=e.audioProxy,z=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",A,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),A=t,y.Z.log("dontTranslateYourLang value changed. New value: ",A)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?J():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",z,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),z=t,y.Z.log("syncVolume value changed. New value: ",z)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,console.log(`Set translation from ${e} to ${t}`),$.detectedLanguage=e,$.responseLanguage=t,console.log("VOT GOVNO",e,t))}async function Y(){o.pause(),p.removeEventListener(".translate",Y,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function W(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===z&&(f=Number(e))}async function G(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage=ee,window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==te.author&&(e.detectedLanguage=te.detectedLanguage,e.responseLanguage=b)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&W()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const K=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function J(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==z)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const X=async e=>{$.detectedLanguage||($=await G(),await U($.detectedLanguage,$.responseLanguage)),y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===A&&$.detectedLanguage===b&&$.responseLanguage===b)throw v.Iz[b].VOTDisableFromYourLang;if(te.isLive)throw v.Iz[b].VOTLiveNotSupported;if(te.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await K(e.type)}async function oe(){await Y(),await W()}async function ae(t,a,i){console.log("VOT Video Data: ",$),function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(`${v.g$[u]}${t}`,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&K("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await J(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===z&&function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelectorAll("video").forEach((e=>{e.addEventListener("abort",(async()=>{y.Z.log("lipsync mode is abort"),await oe(),$=""}))})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await Y();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await X(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await X(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(A.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],A=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],z=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,z)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...A];let ee=b,te="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,A,z,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0,$="";y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),$=await G(),await U(e.target.value,$.responseLanguage)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await G(),await U($.detectedLanguage,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,A=e.dontTranslateYourLang,q=e.audioProxy,z=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",A,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),A=t,y.Z.log("dontTranslateYourLang value changed. New value: ",A)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?J():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",z,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),z=t,y.Z.log("syncVolume value changed. New value: ",z)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,console.log(`Set translation from ${e} to ${t}`),$.detectedLanguage=e,$.responseLanguage=t)}async function Y(){o.pause(),p.removeEventListener(".translate",Y,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function W(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===z&&(f=Number(e))}async function G(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage=ee,window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==te.author&&(e.detectedLanguage=te.detectedLanguage,e.responseLanguage=b)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&W()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const K=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function J(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==z)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const X=async e=>{$.detectedLanguage||($=await G(),await U($.detectedLanguage,$.responseLanguage)),y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===A&&$.detectedLanguage===b&&$.responseLanguage===b)throw v.Iz[b].VOTDisableFromYourLang;if(te.isLive)throw v.Iz[b].VOTLiveNotSupported;if(te.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await K(e.type)}async function oe(){await Y(),await W()}async function ae(t,a,i){console.log("VOT Video Data: ",$),function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(`${v.g$[u]}${t}`,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&K("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await J(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===z&&function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelectorAll("video").forEach((e=>{e.addEventListener("abort",(async()=>{y.Z.log("lipsync mode is abort"),await oe(),$=""}))})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await Y();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await X(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await X(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(A.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot-cloudflare.user.js b/dist/vot-cloudflare.user.js index edecaf53..fd89b14c 100644 --- a/dist/vot-cloudflare.user.js +++ b/dist/vot-cloudflare.user.js @@ -2971,7 +2971,6 @@ async function src_main() { console.log(`Set translation from ${from} to ${to}`); videoData.detectedLanguage = from videoData.responseLanguage = to - console.log("VOT GOVNO", from, to) } // data - ytData or VideoData diff --git a/dist/vot-min.user.js b/dist/vot-min.user.js index 1c4fba22..0e0ebb42 100644 --- a/dist/vot-min.user.js +++ b/dist/vot-min.user.js @@ -83,4 +83,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>a,IM:()=>r,Rr:()=>i,iF:()=>o});const o="api.browser.yandex.ru",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var a=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=o(!0),d=a.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},V={log:(...e)=>{},translations:e=>{}};let f=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function L(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function F(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}f in b||(f="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[f].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=b[f].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(B);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,z)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=b[f].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=b[f].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[f].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[f].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te=f,ne="";(async function(){V.log("Loading extension..."),V.log(`Selected menu language: ${f}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(V.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[f].unSupportedExtensionError;return console.error(e),alert(e)}let t;V.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;V.log("[translateProccessor] execute on element: ",n);let B,z=!0,_="";V.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),V.log("video",c);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[f].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),V.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[f].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),V.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[f].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[f][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[f].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[f][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),o=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{V.log("[onchange] select from language",e.target.value),_=await Z(),await Y(e.target.value,_.responseLanguage)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{V.log("[onchange] select to language",e.target.value),_=await Z(),await Y(_.detectedLanguage,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[f].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=b[f].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(b[f].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),j(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=b[f].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,V.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[f].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[f].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,V.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[f].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,V.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[f].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,V.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[f].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,V.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?J():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[f].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,V.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,console.log(`Set translation from ${e} to ${t}`),_.detectedLanguage=e,_.responseLanguage=t,console.log("VOT GOVNO",e,t))}async function G(){o.pause(),c.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[f].translateVideo),m&&(c.volume=m)}async function W(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}async function Z(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage=te,window.location.hostname.includes("youtube.com")?(ne=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==ne.author&&(e.detectedLanguage=ne.detectedLanguage,e.responseLanguage=f)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}x("none",b[f].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&W()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const K=async(e=!1)=>{if(V.log("lipsync video",c),c)if(o.currentTime=c.currentTime,o.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(V.log("lipsync mode is pause"),o.pause()),"stop"===e&&(V.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(V.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(V.log("lipsync mode is playing"),o.play());else{V.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[f].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[f].neededAdditionalExtension:b[f].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else V.log("lipsync mode is not set")};async function J(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[f].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=$(o,n,i,g);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const X=async e=>{_.detectedLanguage||(_=await Z(),await Y(_.detectedLanguage,_.responseLanguage)),V.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(V.log("VideoValidator videoData: ",_),1===E&&_.detectedLanguage===f&&_.responseLanguage===f)throw b[f].VOTDisableFromYourLang;if(ne.isLive)throw b[f].VOTLiveNotSupported;if(ne.isPremiere)throw b[f].VOTPremiere;if(_.duration>14400)throw b[f].VOTVideoIsTooLong}return!0}(),V.log("Run translateFunc"),await ae(e,_.detectedLanguage,_.responseLanguage)};async function Q(e){V.log(`video ${e.type}`),await K(e.type)}async function oe(){await G(),await W()}async function ae(t,a,i){console.log("VOT Video Data: ",_),function(t,n,o,a,i){V.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),e(t,n,o,a,((e,t)=>{if(V.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[f].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[f].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[f].translationTakeMoreThanHour:t>=10&&t%10?b[f].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[f].translationTakeAboutMinute:b[f].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[f].translationTakeFewMinutes);break;case 3:i(!1,b[f].videoBeingTranslated)}}))}(`${y[d]}${t}`,0x4075500000000000,a,i,(async(e,r)=>{if(V.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[f].translationTake)&&(clearTimeout(p),p=setTimeout((()=>ae(t,a,i)),6e4)),r;switch(o.src=r,m=c?.volume,"number"==typeof S&&(o.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(oe(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&K("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,Q))))),x("success",b[f].disableTranslate),await J(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[f].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=$(c,e,n,w);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),g=o,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);V.log(`[document click] ${a} ${s} ${l}`),a||s||(l||r(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,a))),document.addEventListener("touchstart",(e=>l(e,t,a))),document.addEventListener("touchmove",(e=>l(e,t,a))),document.addEventListener("touchend",(e=>l(e,t,a))),document.querySelectorAll("video").forEach((e=>{e.addEventListener("abort",(async()=>{V.log("lipsync mode is abort"),await oe(),_=""}))})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(V.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return V.log("[click translationBtn] audio.src is not empty"),void await G();try{V.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[f].VOTNoVideoIDFound;await X(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[f].VOTNoVideoIDFound;try{await X(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(V.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}V.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)V.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void V.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{V.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(V.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(V.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){V.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}V.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return V.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return V.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))V.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){V.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(V.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))V.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>a,IM:()=>r,Rr:()=>i,iF:()=>o});const o="api.browser.yandex.ru",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var a=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=o(!0),d=a.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},V={log:(...e)=>{},translations:e=>{}};let f=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function L(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function F(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}f in b||(f="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[f].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=b[f].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(B);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,z)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=b[f].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=b[f].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[f].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[f].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te=f,ne="";(async function(){V.log("Loading extension..."),V.log(`Selected menu language: ${f}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(V.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[f].unSupportedExtensionError;return console.error(e),alert(e)}let t;V.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;V.log("[translateProccessor] execute on element: ",n);let B,z=!0,_="";V.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),V.log("video",c);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[f].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),V.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[f].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),V.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[f].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[f][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[f].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[f][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),o=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{V.log("[onchange] select from language",e.target.value),_=await Z(),await Y(e.target.value,_.responseLanguage)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{V.log("[onchange] select to language",e.target.value),_=await Z(),await Y(_.detectedLanguage,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[f].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=b[f].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(b[f].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),j(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=b[f].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,V.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[f].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[f].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,V.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[f].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,V.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[f].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,V.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[f].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,V.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?J():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[f].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,V.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,console.log(`Set translation from ${e} to ${t}`),_.detectedLanguage=e,_.responseLanguage=t)}async function G(){o.pause(),c.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[f].translateVideo),m&&(c.volume=m)}async function W(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}async function Z(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage=te,window.location.hostname.includes("youtube.com")?(ne=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==ne.author&&(e.detectedLanguage=ne.detectedLanguage,e.responseLanguage=f)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}x("none",b[f].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&W()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const K=async(e=!1)=>{if(V.log("lipsync video",c),c)if(o.currentTime=c.currentTime,o.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(V.log("lipsync mode is pause"),o.pause()),"stop"===e&&(V.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(V.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(V.log("lipsync mode is playing"),o.play());else{V.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[f].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[f].neededAdditionalExtension:b[f].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else V.log("lipsync mode is not set")};async function J(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[f].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=$(o,n,i,g);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const X=async e=>{_.detectedLanguage||(_=await Z(),await Y(_.detectedLanguage,_.responseLanguage)),V.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(V.log("VideoValidator videoData: ",_),1===E&&_.detectedLanguage===f&&_.responseLanguage===f)throw b[f].VOTDisableFromYourLang;if(ne.isLive)throw b[f].VOTLiveNotSupported;if(ne.isPremiere)throw b[f].VOTPremiere;if(_.duration>14400)throw b[f].VOTVideoIsTooLong}return!0}(),V.log("Run translateFunc"),await ae(e,_.detectedLanguage,_.responseLanguage)};async function Q(e){V.log(`video ${e.type}`),await K(e.type)}async function oe(){await G(),await W()}async function ae(t,a,i){console.log("VOT Video Data: ",_),function(t,n,o,a,i){V.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),e(t,n,o,a,((e,t)=>{if(V.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[f].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[f].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[f].translationTakeMoreThanHour:t>=10&&t%10?b[f].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[f].translationTakeAboutMinute:b[f].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[f].translationTakeFewMinutes);break;case 3:i(!1,b[f].videoBeingTranslated)}}))}(`${y[d]}${t}`,0x4075500000000000,a,i,(async(e,r)=>{if(V.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[f].translationTake)&&(clearTimeout(p),p=setTimeout((()=>ae(t,a,i)),6e4)),r;switch(o.src=r,m=c?.volume,"number"==typeof S&&(o.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(oe(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&K("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,Q))))),x("success",b[f].disableTranslate),await J(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[f].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=$(c,e,n,w);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),g=o,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);V.log(`[document click] ${a} ${s} ${l}`),a||s||(l||r(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,a))),document.addEventListener("touchstart",(e=>l(e,t,a))),document.addEventListener("touchmove",(e=>l(e,t,a))),document.addEventListener("touchend",(e=>l(e,t,a))),document.querySelectorAll("video").forEach((e=>{e.addEventListener("abort",(async()=>{V.log("lipsync mode is abort"),await oe(),_=""}))})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(V.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return V.log("[click translationBtn] audio.src is not empty"),void await G();try{V.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[f].VOTNoVideoIDFound;await X(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[f].VOTNoVideoIDFound;try{await X(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(V.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}V.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)V.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void V.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{V.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(V.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(V.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){V.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}V.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return V.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return V.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))V.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){V.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(V.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))V.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot.user.js b/dist/vot.user.js index d21fb6cb..293a5ee7 100644 --- a/dist/vot.user.js +++ b/dist/vot.user.js @@ -2900,7 +2900,6 @@ async function src_main() { console.log(`Set translation from ${from} to ${to}`); videoData.detectedLanguage = from videoData.responseLanguage = to - console.log("VOT GOVNO", from, to) } // data - ytData or VideoData diff --git a/src/index.js b/src/index.js index 7f7a9d14..9599d856 100644 --- a/src/index.js +++ b/src/index.js @@ -531,7 +531,6 @@ async function main() { console.log(`Set translation from ${from} to ${to}`); videoData.detectedLanguage = from videoData.responseLanguage = to - console.log("VOT GOVNO", from, to) } // data - ytData or VideoData From a0bfa456062aa35e2e08f2b3597b9840d4b4b870 Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Mon, 7 Aug 2023 06:58:20 +0400 Subject: [PATCH 48/48] mini change --- dist/vot-cloudflare-min.user.js | 2 +- dist/vot-cloudflare.user.js | 2 +- dist/vot-min.user.js | 2 +- dist/vot.user.js | 2 +- src/utils/getYTVideoData.js | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dist/vot-cloudflare-min.user.js b/dist/vot-cloudflare-min.user.js index cf628604..ff8b7fa4 100644 --- a/dist/vot-cloudflare-min.user.js +++ b/dist/vot-cloudflare-min.user.js @@ -84,4 +84,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot-cloudflare.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],A=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],z=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,z)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...A];let ee=b,te="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,A,z,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0,$="";y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),$=await G(),await U(e.target.value,$.responseLanguage)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await G(),await U($.detectedLanguage,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,A=e.dontTranslateYourLang,q=e.audioProxy,z=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",A,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),A=t,y.Z.log("dontTranslateYourLang value changed. New value: ",A)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?J():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",z,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),z=t,y.Z.log("syncVolume value changed. New value: ",z)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,console.log(`Set translation from ${e} to ${t}`),$.detectedLanguage=e,$.responseLanguage=t)}async function Y(){o.pause(),p.removeEventListener(".translate",Y,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function W(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===z&&(f=Number(e))}async function G(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage=ee,window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==te.author&&(e.detectedLanguage=te.detectedLanguage,e.responseLanguage=b)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&W()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const K=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function J(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==z)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const X=async e=>{$.detectedLanguage||($=await G(),await U($.detectedLanguage,$.responseLanguage)),y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===A&&$.detectedLanguage===b&&$.responseLanguage===b)throw v.Iz[b].VOTDisableFromYourLang;if(te.isLive)throw v.Iz[b].VOTLiveNotSupported;if(te.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await K(e.type)}async function oe(){await Y(),await W()}async function ae(t,a,i){console.log("VOT Video Data: ",$),function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(`${v.g$[u]}${t}`,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&K("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await J(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===z&&function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelectorAll("video").forEach((e=>{e.addEventListener("abort",(async()=>{y.Z.log("lipsync mode is abort"),await oe(),$=""}))})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await Y();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await X(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await X(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(A.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config-cloudflare.js":(e,t,n)=>{n.d(t,{I:()=>a,i:()=>o});const o="vot.toil-dump.workers.dev",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm"},"./src/config/config.js":(e,t,n)=>{n.d(t,{IM:()=>a,Rr:()=>o});const o="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",a=.15},"./src/config/constants.js":(e,t,n)=>{n.d(t,{Iz:()=>r,ey:()=>o,g$:()=>i,tW:()=>a});const o=0x4075500000000000,a={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},i={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},r={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}}},"./src/rvt-cloudflare.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>l});var a=n("./src/yandexRequests.js"),i=n("./src/config/config-cloudflare.js"),r=n("./src/config/config.js"),s=n("./src/utils/debug.js");const l=async function(e,t,n,l,d){let u,c;const p=o(!0),m=a.G.encodeRequest(e,p,t,n,l);try{s.Z.log("requestVideoTranslation");const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,m),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),l={method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify({headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":r.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},body:String.fromCharCode(...m)})};u=await fetch(`https://${i.i}/video-translation/translate`,l),c=await u.arrayBuffer()}catch(e){s.Z.log(e),u={status:-1},c=e}d(200==u.status,c)}},"./src/utils/debug.js":(e,t,n)=>{n.d(t,{Z:()=>o}),n("./src/config/constants.js");const o={log:(...e)=>{},translations:e=>{}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/\s+/g," ").trim().replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js"),v=n("./src/config/constants.js"),y=n("./src/utils/debug.js");let b=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function f(e){document.querySelector(".translationBtn").style.color=e}function V(e="none"){document.querySelector(".translationBtn").dataset.state=e}function w(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function O(e="none",t){switch(e){case"error":w(e),f("#7A7A7D"),V(e);break;case"success":w(e),f("#A36EFF"),V(e);break;default:w("none"),f("#FFFFFF"),V("none")}document.querySelector(".translationBtn").innerText=t}function S(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function x(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function k(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function L(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}b in v.Iz||(b="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const F=e=>new Promise((t=>setTimeout(t,e))),I=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var D=n("./src/config/config.js");const M=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],A=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],z=2,q={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},E={audioProxy:0};function P(e){return indexedDB.open(e,z)}async function B(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{console.error(`${v.Iz[b].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=v.Iz[b].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(q).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(q);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(q,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,E)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function C({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=P("VOT");d.onerror=()=>{const e=v.Iz[b].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await B(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=v.Iz[b].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function N(){indexedDB.deleteDatabase("VOT")}function j(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}var R=n("./src/config/config-cloudflare.js");const Z={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},$=".html5-video-container",_=".video-ref",H="main > div > section > div > div > div",U=".shaka-video-container",Y=".videoplayer_media",W='div[data-testid="videoComponent"] > div:nth-child(1) > div',G=".player",K=".video-post",J=".bpx-player-video-wrap",X="#b-video-wrapper",Q=[...M,...A];let ee=b,te="";(async function(){y.Z.log("Loading extension..."),y.Z.log(`Selected menu language: ${b}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt-cloudflare.js"))).default;let t;y.Z.log("Inited requestVideoTranslation..."),y.Z.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;var r=!1;function s(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function l(){clearTimeout(t),s(1),t=setTimeout((()=>{s(0)}),2e3)}function d(e,t,n){clearTimeout(t),s(n),e.stopPropagation()}async function u(n,u,c){let p,m,g,f,V,w,L,F,M,A,z,q;y.Z.log("[translateProccessor] execute on element: ",n);let E,Z=!0,$="";y.Z.log("videoContainer",n),p="vimeo"===u?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),y.Z.log("video",p);const _="pornhub"===u&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===u&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${v.Iz[b].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),y.Z.log("VOT: Added translation button to ",e)}(_),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${v.Iz[b].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),N(),location.reload()})),y.Z.log("VOT: Added translation menu to ",e)}(_);try{E=await B()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const H=document.querySelector(".translationMenuOptions");if(H&&!H.querySelector("#VOTTranslateFromLang")){const e=[{label:v.Iz[b].videoLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.detectedLanguage===e})))],t=[{label:v.Iz[b].translationLanguage,value:"default",disabled:!0},...Object.entries(v.tW).map((([e,t])=>({label:v.Iz[b][t],value:e,selected:$.responseLanguage===e})))],n=k("VOTTranslateFromLang",e),o=k("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),H.appendChild(n),H.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select from language",e.target.value),$=await G(),await U(e.target.value,$.responseLanguage)})),H.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{y.Z.log("[onchange] select to language",e.target.value),$=await G(),await U($.detectedLanguage,e.target.value)}))}if(E){const e=await async function(){return new Promise(((e,t)=>{const n=P("VOT");n.onerror=()=>{const e=v.Iz[b].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await B(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=v.Iz[b].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(v.Iz[b].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),N(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=v.Iz[b].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(w=e.autoTranslate,L=e.defaultVolume,F=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,A=e.dontTranslateYourLang,q=e.audioProxy,z=e.syncVolume,y.Z.log("[db] data from db: ",e),void 0!==w&&H&&!H.querySelector("#VOTAutoTranslate")){const e=S("VOTAutoTranslate",w,v.Iz[b].VOTAutoTranslate+("vk"===u||window.location.hostname.includes("m.twitch.tv")?` (${v.Iz[b].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoTranslate:t}),w=t,y.Z.log("autoTranslate value changed. New value: ",w)},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==A&&H&&!H.querySelector("#VOTDontTranslateYourLang")){const e=S("VOTDontTranslateYourLang",A,v.Iz[b].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({dontTranslateYourLang:t}),A=t,y.Z.log("dontTranslateYourLang value changed. New value: ",A)},H.appendChild(e)}if(void 0!==M&&H&&!H.querySelector("#VOTAutoSetVolume")){const e=S("VOTAutoSetVolume",M,v.Iz[b].VOTAutoSetVolume+(100*D.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({autoSetVolumeYandexStyle:t}),M=t,y.Z.log("autoSetVolumeYandexStyle value changed. New value: ",M)},H.appendChild(e)}if(void 0!==F&&H&&!H.querySelector("#VOTShowVideoSlider")){const e=S("VOTShowVideoSlider",F,v.Iz[b].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({showVideoSlider:t}),F=t,y.Z.log("showVideoSlider value changed. New value: ",F),1===F&&"success"===document.querySelector(".translationBtn").dataset.state?J():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},H.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==z&&H&&!H.querySelector("#VOTSyncVolume")){const e=S("VOTSyncVolume",z,v.Iz[b].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({syncVolume:t}),z=t,y.Z.log("syncVolume value changed. New value: ",z)},H.appendChild(e)}if(void 0!==q&&H&&!H.querySelector("#VOTAudioProxy")){const e=S("VOTAudioProxy",q,v.Iz[b].VOTAudioProxy);e.querySelector("#VOTAudioProxy").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await C({audioProxy:t}),q=t,y.Z.log("audioProxy value changed. New value: ",q)},H.appendChild(e)}}}async function U(e,t){document.querySelector("#VOTSelectLanguages")&&(document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,console.log(`Set translation from ${e} to ${t}`),$.detectedLanguage=e,$.responseLanguage=t)}async function Y(){o.pause(),p.removeEventListener(".translate",Y,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",O("none",v.Iz[b].translateVideo),g&&(p.volume=g)}async function W(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===z&&(f=Number(e))}async function G(){const e={};return e.duration=p?.duration||0,e.videoId=I(u),e.detectedLanguage="en",e.responseLanguage=ee,window.location.hostname.includes("youtube.com")?(te=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==te.author&&(e.detectedLanguage=te.detectedLanguage,e.responseLanguage=b)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}O("none",v.Iz[b].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&W()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const K=async(e=!1)=>{if(y.Z.log("lipsync video",p),p)if(o.currentTime=p.currentTime,o.playbackRate=p.playbackRate,e)if("play"!==e)"pause"===e&&(y.Z.log("lipsync mode is pause"),o.pause()),"stop"===e&&(y.Z.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(y.Z.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(y.Z.log("lipsync mode is playing"),o.play());else{y.Z.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=v.Iz[b].grantPermissionToAutoPlay;throw O("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=Q.includes(window.location.hostname)?v.Iz[b].neededAdditionalExtension:v.Iz[b].audioFormatNotSupported;throw O("error",e),`VOT: ${e}`}}))}else y.Z.log("lipsync mode is not set")};async function J(){if(1!==F||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*p.volume);f=e;const t=x("VOTVideoSlider",e,`${v.Iz[b].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(p.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==z)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=j(o,n,i,f);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),V=r,f=n},document.querySelector(".translationMenuOptions").appendChild(t)}const X=async e=>{$.detectedLanguage||($=await G(),await U($.detectedLanguage,$.responseLanguage)),y.Z.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(y.Z.log("VideoValidator videoData: ",$),1===A&&$.detectedLanguage===b&&$.responseLanguage===b)throw v.Iz[b].VOTDisableFromYourLang;if(te.isLive)throw v.Iz[b].VOTLiveNotSupported;if(te.isPremiere)throw v.Iz[b].VOTPremiere;if($.duration>14400)throw v.Iz[b].VOTVideoIsTooLong}return!0}(),y.Z.log("Run translateFunc"),await ae(e,$.detectedLanguage,$.responseLanguage)};async function ne(e){y.Z.log(`video ${e.type}`),await K(e.type)}async function oe(){await Y(),await W()}async function ae(t,a,i){console.log("VOT Video Data: ",$),function(t,n,o,a,i){y.Z.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),r?y.Z.log("translationPanding return"):(r=!0,e(t,n,o,a,((e,t)=>{if(r=!1,y.Z.log("[exec callback] Requesting video translation"),!e)return void i(!1,v.Iz[b].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||v.Iz[b].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?v.Iz[b].translationTakeMoreThanHour:t>=10&&t%10?v.Iz[b].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?v.Iz[b].translationTakeAboutMinute:v.Iz[b].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):v.Iz[b].translationTakeFewMinutes);break;case 3:i(!1,v.Iz[b].videoBeingTranslated)}})))}(`${v.g$[u]}${t}`,v.ey,a,i,(async(e,r)=>{if(y.Z.log("[exec callback] translateVideo"),I(u)!==t)return;if(!e)throw O("error",r),r.includes(v.Iz[b].translationTake)&&(clearTimeout(m),m=setTimeout((()=>ae(t,a,i)),6e4)),r;if(o.src=r,1===q&&r.startsWith("https://")){const e=r.replace("https://vtrans.s3-private.mds.yandex.net/tts/prod/",""),t=`https://${R.i}/video-translation/audio-proxy/${e}`;console.log(`VOT Audio proxied via ${t}`),o.src=t}switch(g=p?.volume,"number"==typeof L&&(o.volume=L/100),"number"==typeof M&&M&&(p.volume=D.IM),u){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==c&&document.body.addEventListener(c,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===p&&""!==e.target.src&&(oe(),Z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}p&&!p.paused&&K("play");const l=document.querySelectorAll("video"),d=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>d.forEach((t=>e.addEventListener(t,ne))))),O("success",v.Iz[b].disableTranslate),await J(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof L?L:100;f=e;const t=x("VOTTranslationSlider",e,`${v.Iz[b].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await C({defaultVolume:Number(e)}),L=Number(e),1===z&&function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=j(p,e,n,V);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),f=o,V=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const h=document.querySelector("#VOTVideoSlider");h&&(h.value=100*D.IM);const T=document.querySelector("#VOTOriginalVolume");T&&(T.innerText=100*D.IM+"%");const w=document.querySelector(".translationDownload");w.href=r,w.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),r=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);y.Z.log(`[document click] ${a} ${r} ${l}`),a||r||(l||s(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===u?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],l):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],l):ie("twitter"===u?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],l),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>d(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>d(e,t,a))),document.addEventListener("touchstart",(e=>d(e,t,a))),document.addEventListener("touchmove",(e=>d(e,t,a))),document.addEventListener("touchend",(e=>d(e,t,a))),document.querySelectorAll("video").forEach((e=>{e.addEventListener("abort",(async()=>{y.Z.log("lipsync mode is abort"),await oe(),$=""}))})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(y.Z.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return y.Z.log("[click translationBtn] audio.src is not empty"),void await Y();try{y.Z.log("[click translationBtn] trying execute translation");const e=I(u);if(!e)throw v.Iz[b].VOTNoVideoIDFound;await X(e)}catch(e){O("error",String(e).substring(4,e.length)),console.error(e)}})),p.addEventListener("progress",(async e=>{if(e.stopPropagation(),!Z||1!==w)return;const t=I(u);if(!t)throw v.Iz[b].VOTNoVideoIDFound;try{await X(t),Z=!1}catch(e){O("error",String(e).substring(4,e.length)),Z=!1}}))}await async function(){if(y.Z.log("Runned initWebsite function"),Z.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await u(e,"youtube",null)}y.Z.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector($);if(e)y.Z.log("[exec] translateProccessor youtube on page enter"),u(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void y.Z.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{y.Z.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),u(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await L("#player");e&&(await F(1e3),await u(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await L("#player"),await F(1e3),await u(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(y.Z.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(y.Z.log("[initWebsite] Matched Twitch Mobile"),await L(H)){await F(200);const e=document.querySelector(H);await u(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await F(1e3),await u(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){y.Z.log("[initWebsite] Matched Twitch Desktop");const e=await L(_);e&&(await F(200),await u(e,"twitch",null))}y.Z.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return y.Z.log("[entered] xvideos"),await F(1e3),void await u(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return y.Z.log("[entered] pornhub"),await F(1e3),void await u(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(M.includes(window.location.hostname))y.Z.log("[entered] invidious"),await u(document.querySelector("#player"),"youtube",null);else if(A.includes(window.location.hostname)){y.Z.log("[entered] piped");const e=await L(U);if(e){let t,n=I("youtube");await u(e,"youtube","piped"),setInterval((async()=>{t=I("youtube"),n!==t&&(t&&await u(document.querySelector(U),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(y.Z.log("[entered] vk.com"),await L(Y)){let e;await u(document.querySelector(Y),"vk",null);let t=I("vk");setInterval((async()=>{if(e=I("vk"),t!==e){if(e){const e=await L(Y);e&&await u(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))y.Z.log("[entered] vimeo.com"),await L(G)&&(await F(1e3),await u(document.querySelector(G),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await F(1e3),await u(document.querySelector(K),"9gag",null);else if(window.location.hostname.includes("coub.com"))await F(1e3),await u(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await L(e);t&&await u(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await L(J);e&&await u(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await L("video");e&&await u(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await L(W);if(e){let t,n=I("twitter");await u(e,"twitter",null),setInterval((async()=>{t=I("twitter"),n!==t&&(t&&await u(document.querySelector(W),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await L(X);if(e){let t,n=I("mail.ru");await u(e,"mail.ru",null),setInterval((async()=>{t=I("mail.ru"),n!==t&&(t&&await u(document.querySelector(X),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot-cloudflare.user.js b/dist/vot-cloudflare.user.js index fd89b14c..90b782c8 100644 --- a/dist/vot-cloudflare.user.js +++ b/dist/vot-cloudflare.user.js @@ -1592,9 +1592,9 @@ async function getLanguage(player, response, title, description, author) { const text = [title, description, author].join(" "); // Remove anything that is not a letter or a space in any language const cleanText = text + .replace(/\s+/g, " ").trim() .replace(/https?:\/\/\S+/g, "") .replace(/[^\p{L}\s]/gu, "") - .trim() .slice(0, 250); return await detect(cleanText); } diff --git a/dist/vot-min.user.js b/dist/vot-min.user.js index 0e0ebb42..0cd82671 100644 --- a/dist/vot-min.user.js +++ b/dist/vot-min.user.js @@ -83,4 +83,4 @@ // @updateURL https://raw.githubusercontent.com/ilyhalight/voice-over-translation/master/dist/vot.user.js // ==/UserScript== -(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>a,IM:()=>r,Rr:()=>i,iF:()=>o});const o="api.browser.yandex.ru",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var a=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=o(!0),d=a.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").trim().slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},V={log:(...e)=>{},translations:e=>{}};let f=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function L(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function F(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}f in b||(f="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[f].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=b[f].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(B);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,z)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=b[f].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=b[f].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[f].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[f].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te=f,ne="";(async function(){V.log("Loading extension..."),V.log(`Selected menu language: ${f}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(V.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[f].unSupportedExtensionError;return console.error(e),alert(e)}let t;V.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;V.log("[translateProccessor] execute on element: ",n);let B,z=!0,_="";V.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),V.log("video",c);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[f].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),V.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[f].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),V.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[f].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[f][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[f].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[f][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),o=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{V.log("[onchange] select from language",e.target.value),_=await Z(),await Y(e.target.value,_.responseLanguage)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{V.log("[onchange] select to language",e.target.value),_=await Z(),await Y(_.detectedLanguage,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[f].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=b[f].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(b[f].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),j(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=b[f].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,V.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[f].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[f].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,V.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[f].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,V.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[f].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,V.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[f].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,V.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?J():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[f].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,V.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,console.log(`Set translation from ${e} to ${t}`),_.detectedLanguage=e,_.responseLanguage=t)}async function G(){o.pause(),c.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[f].translateVideo),m&&(c.volume=m)}async function W(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}async function Z(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage=te,window.location.hostname.includes("youtube.com")?(ne=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==ne.author&&(e.detectedLanguage=ne.detectedLanguage,e.responseLanguage=f)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}x("none",b[f].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&W()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const K=async(e=!1)=>{if(V.log("lipsync video",c),c)if(o.currentTime=c.currentTime,o.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(V.log("lipsync mode is pause"),o.pause()),"stop"===e&&(V.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(V.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(V.log("lipsync mode is playing"),o.play());else{V.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[f].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[f].neededAdditionalExtension:b[f].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else V.log("lipsync mode is not set")};async function J(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[f].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=$(o,n,i,g);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const X=async e=>{_.detectedLanguage||(_=await Z(),await Y(_.detectedLanguage,_.responseLanguage)),V.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(V.log("VideoValidator videoData: ",_),1===E&&_.detectedLanguage===f&&_.responseLanguage===f)throw b[f].VOTDisableFromYourLang;if(ne.isLive)throw b[f].VOTLiveNotSupported;if(ne.isPremiere)throw b[f].VOTPremiere;if(_.duration>14400)throw b[f].VOTVideoIsTooLong}return!0}(),V.log("Run translateFunc"),await ae(e,_.detectedLanguage,_.responseLanguage)};async function Q(e){V.log(`video ${e.type}`),await K(e.type)}async function oe(){await G(),await W()}async function ae(t,a,i){console.log("VOT Video Data: ",_),function(t,n,o,a,i){V.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),e(t,n,o,a,((e,t)=>{if(V.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[f].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[f].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[f].translationTakeMoreThanHour:t>=10&&t%10?b[f].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[f].translationTakeAboutMinute:b[f].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[f].translationTakeFewMinutes);break;case 3:i(!1,b[f].videoBeingTranslated)}}))}(`${y[d]}${t}`,0x4075500000000000,a,i,(async(e,r)=>{if(V.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[f].translationTake)&&(clearTimeout(p),p=setTimeout((()=>ae(t,a,i)),6e4)),r;switch(o.src=r,m=c?.volume,"number"==typeof S&&(o.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(oe(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&K("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,Q))))),x("success",b[f].disableTranslate),await J(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[f].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=$(c,e,n,w);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),g=o,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);V.log(`[document click] ${a} ${s} ${l}`),a||s||(l||r(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,a))),document.addEventListener("touchstart",(e=>l(e,t,a))),document.addEventListener("touchmove",(e=>l(e,t,a))),document.addEventListener("touchend",(e=>l(e,t,a))),document.querySelectorAll("video").forEach((e=>{e.addEventListener("abort",(async()=>{V.log("lipsync mode is abort"),await oe(),_=""}))})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(V.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return V.log("[click translationBtn] audio.src is not empty"),void await G();try{V.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[f].VOTNoVideoIDFound;await X(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[f].VOTNoVideoIDFound;try{await X(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(V.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}V.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)V.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void V.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{V.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(V.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(V.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){V.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}V.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return V.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return V.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))V.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){V.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(V.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))V.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file +(()=>{"use strict";var e={"./node_modules/css-loader/dist/cjs.js!./src/styles/main.css":(e,t,n)=>{n.d(t,{Z:()=>s});var o=n("./node_modules/css-loader/dist/runtime/noSourceMaps.js"),a=n.n(o),i=n("./node_modules/css-loader/dist/runtime/api.js"),r=n.n(i)()(a());r.push([e.id,'.translationBlock {\n padding: 0.45rem !important;\n width: max-content;\n position: absolute;\n background: #2e2f34;\n border-radius: 0.5rem !important;\n left: 50%;\n top: 5rem;\n transform: translate(-50%);\n text-align: center;\n opacity: 0;\n transition: opacity 1s;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n z-index: 100;\n}\n\n.translationBtn {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n color: #fff;\n padding-right: 0.25rem !important;\n cursor: pointer;\n font: 600 12px / 14px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif;\n}\n\n.translationBlock:hover {\n opacity: 1;\n}\n\n.translationMenu {\n display: inline-block;\n vertical-align: middle;\n border-left: 1px solid #424348;\n max-height: 16px;\n max-width: 24px;\n cursor: pointer;\n}\n\n.translationMenuIcon {\n padding: 0 10px !important;\n width: 24px;\n}\n\n.translationIAlice {\n display: inline-block;\n vertical-align: middle;\n max-height: 26px;\n max-width: 50px;\n}\n\n.translationIconAlice {\n height: 24px !important;\n width: 24px !important;\n}\n\n.translationITranslate {\n display: inline-block;\n vertical-align: middle;\n max-height: 20px;\n max-width: 20px;\n}\n\n.translationMenuContent {\n position: absolute;\n background: #2e2f34;\n color: #fff;\n display: none;\n border-radius: 1rem !important;\n left: 50%;\n top: 10rem;\n transform: translate(-50%);\n text-align: left;\n font: 600 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n\n width: 300px;\n /* height: 375px; */\n opacity: 0;\n z-index: 100;\n transition: opacity 0.5s ease;\n}\n\n.VOTMenuSlider {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 268px !important;\n height: 8px !important;\n outline: none !important;\n margin-top: 0.5rem;\n opacity: 0.7;\n /* background: #3C3F4D !important; */\n background: rgb(253, 222, 85, 0.6) !important;\n border: none !important;\n border-radius: 2rem !important;\n -webkit-transition: 0.2s !important;\n transition: opacity 0.2s ease !important;\n}\n\n.VOTMenuSlider:hover {\n opacity: 1;\n}\n\n.VOTMenuSlider::-webkit-slider-thumb {\n -webkit-appearance: none !important;\n appearance: none !important;\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-moz-range-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-thumb {\n width: 10px !important;\n height: 10px !important;\n border-radius: 50% !important;\n border: none !important;\n background: #fff !important;\n cursor: pointer !important;\n}\n\n.VOTMenuSlider::-ms-fill-lower {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.VOTMenuSlider::-moz-range-progress {\n height: 8px !important;\n border-radius: 2rem !important;\n background: linear-gradient(\n 90.1deg,\n rgba(186, 153, 244, 0.85) -5.78%,\n rgba(236, 138, 202, 0.7) 56.46%,\n rgba(239, 168, 117, 0.6) 108.93%\n ) !important;\n}\n\n.translationHeader {\n padding-bottom: 0.5rem !important;\n}\n\n.translationMainHeader {\n margin: 16px !important;\n color: #fff;\n font: 900 14px / 16px "Segoe UI", BlinkMacSystemFont, Arial, sans-serif !important;\n}\n\n.translationMenuOptions {\n display: flex;\n flex-flow: column wrap;\n}\n\n.translationMenuContainer {\n /* width: 100%; */\n padding-left: 16px !important;\n padding-top: 5px !important;\n display: inline-block !important;\n}\n\n.translationMenuContainer > input {\n appearance: auto !important;\n vertical-align: text-bottom;\n}\n\n.translationMenuText {\n color: #fff;\n display: inline-flex;\n width: 80%;\n}\n\n.translationVolumeBox,\n.translationVideoVolumeBox {\n padding-top: 0.5rem !important;\n}\n\n.translationDropDB {\n border: none !important;\n border-radius: 4px !important;\n background: #5426ff !important;\n color: #fff !important;\n padding: 6px 16px !important;\n margin-left: auto !important;\n cursor: pointer !important;\n}\n\n.translationDownload {\n background: #5426ff !important;\n color: #fff !important;\n padding: 2px 10px !important;\n border-radius: 4px !important;\n cursor: pointer;\n display: none;\n}\n\n.translationMenuFunctional {\n display: flex;\n margin: 16px !important;\n}\n\n.VOTMenuSelect {\n width: 110px;\n border-radius: 5px !important;\n border: 1px solid #dadce0 !important;\n box-shadow: 0 1px 3px -2px #9098a9;\n box-sizing: border-box !important;\n color: #2e2f34 !important;\n background: #fff !important;\n padding: 5px !important;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n}\n\n.VOTMenuSelect:focus {\n outline: none;\n border-color: #0077ff;\n box-shadow: 0 0 0 2px rgba(#0077ff, 0.2);\n}\n\n#VOTSelectLanguages {\n display: flex !important;\n margin-left: 5px;\n}\n\n#VOTSelectLanguages svg {\n margin: 0 5px;\n}\n',""]);const s=r},"./node_modules/css-loader/dist/runtime/api.js":e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(o)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),a&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=a):u[4]="".concat(a)),t.push(u))}},t}},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":e=>{e.exports=function(e){return e[1]}},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,a&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},"./src/config/config.js":(e,t,n)=>{n.d(t,{I1:()=>a,IM:()=>r,Rr:()=>i,iF:()=>o});const o="api.browser.yandex.ru",a="gnnde87s24kcuMH8rbWhLyfeuEKDkGGm",i="Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 CriOS/104.0.5112.114 YaBrowser/22.9.4.633.10 SA/3 Mobile/15E148 Safari/604.1",r=.15},"./src/rvt.js":(e,t,n)=>{function o(e){const t=([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)));return e?t:t.toUpperCase()}n.r(t),n.d(t,{default:()=>r});var a=n("./src/yandexRequests.js"),i=n("./src/config/config.js");const r=async function(e,t,n,r,s){const l=o(!0),d=a.G.encodeRequest(e,l,t,n,r);try{const e=new TextEncoder("utf-8"),t=await window.crypto.subtle.importKey("raw",e.encode(i.I1),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await window.crypto.subtle.sign("HMAC",t,d),a=Array.from(new Uint8Array(n),(e=>e.toString(16).padStart(2,"0"))).join(""),r={url:`https://${i.iF}/video-translation/translate`,method:"POST",headers:{Accept:"application/x-protobuf","Accept-Language":"en","Content-Type":"application/x-protobuf","User-Agent":i.Rr,Pragma:"no-cache","Cache-Control":"no-cache","Sec-Fetch-Mode":"no-cors","sec-ch-ua":null,"sec-ch-ua-mobile":null,"sec-ch-ua-platform":null,"Vtrans-Signature":a,"Sec-Vtrans-Token":o(!1)},data:String.fromCharCode(...d),responseType:"arraybuffer"};GM_xmlhttpRequest({...r,onload:e=>{s(200===e.status,e.response)},onerror:e=>{s(!1)}})}catch(e){s(!1)}}},"./src/yandexRequests.js":(e,t,n)=>{n.d(t,{G:()=>r});const o=new protobuf.Type("VideoTranslationRequest").add(new protobuf.Field("url",3,"string")).add(new protobuf.Field("deviceId",4,"string")).add(new protobuf.Field("firstRequest",5,"bool")).add(new protobuf.Field("unknown1",6,"fixed64")).add(new protobuf.Field("unknown2",7,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("unknown3",9,"int32")).add(new protobuf.Field("unknown4",10,"int32")).add(new protobuf.Field("translationHelp",11,"int32")).add(new protobuf.Field("responseLanguage",14,"string")),a=new protobuf.Type("VideoTranslationResponse").add(new protobuf.Field("url",1,"string")).add(new protobuf.Field("duration",2,"double")).add(new protobuf.Field("status",4,"int32")).add(new protobuf.Field("remainingTime",5,"int32")).add(new protobuf.Field("language",8,"string")).add(new protobuf.Field("message",9,"string")),i=(new protobuf.Root).define("yandex").add(o).add(a),r={encodeRequest:(e,t,n,o,a)=>i.VideoTranslationRequest.encode({url:e,deviceId:t,firstRequest:!0,unknown1:n,unknown2:1,language:o,unknown3:0,unknown4:0,responseLanguage:a}).finish(),decodeResponse:e=>i.VideoTranslationResponse.decode(new Uint8Array(e))}}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,(()=>{var e=n("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),t=n.n(e),o=n("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),a=n.n(o),i=n("./node_modules/style-loader/dist/runtime/insertBySelector.js"),r=n.n(i),s=n("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),l=n.n(s),d=n("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),u=n.n(d),c=n("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),p=n.n(c),m=n("./node_modules/css-loader/dist/cjs.js!./src/styles/main.css"),g={};async function h(e,t,n,o,a){if(!window.location.hostname.includes("m.youtube.com")){const t=e.getAudioTrack(),n=t?.getLanguageInfo();if("und"!==n?.id)return n.id.split(".")[0]}const i=t?.captions?.playerCaptionsTracklistRenderer?.captionTracks;if(i?.length){const e=i.find((e=>"asr"===e.kind));if(e)return e.languageCode}const r=[n,o,a].join(" ").replace(/\s+/g," ").trim().replace(/https?:\/\/\S+/g,"").replace(/[^\p{L}\s]/gu,"").slice(0,250);return await async function(e){const t=await fetch("https://rust-server-531j.onrender.com/detect",{method:"POST",body:e});return await t.text()}(r)}g.styleTagTransform=p(),g.setAttributes=l(),g.insert=r().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u(),t()(m.Z,g),m.Z&&m.Z.locals&&m.Z.locals;var T=n("./src/yandexRequests.js");const v={ru:"Russian",en:"English",zh:"Chinese",fr:"French",it:"Italian",es:"Spanish",de:"German"},y={youtube:"https://youtu.be/",twitch:"https://twitch.tv/",vimeo:"https://vimeo.com/","9gag":"https://9gag.com/gag/",vk:"https://vk.com/video?z=",xvideos:"https://www.xvideos.com/",pornhub:"https://rt.pornhub.com/view_video.php?viewkey=",udemy:"https://www.udemy.com",twitter:"https://twitter.com/i/status/",facebook:"https://www.facebook.com/",rutube:"https://rutube.ru/video/","bilibili.com":"https://www.bilibili.com/video/","mail.ru":"https://my.mail.ru/",coub:"https://coub.com/view/"},b={ru:{recommended:"рекомендуется",translateVideo:"Перевести видео",disableTranslate:"Выключить",translationSettings:"Настройки перевода",resetSettings:"Сбросить настройки",videoBeingTranslated:"Видео переводится",videoLanguage:"Язык видео",translationLanguage:"Язык перевода",translationTake:"Перевод займёт",translationTakeMoreThanHour:"Перевод займёт больше часа",translationTakeAboutMinute:"Перевод займёт около минуты",translationTakeFewMinutes:"Перевод займёт несколько минут",translationTakeApproximatelyMinutes:"Перевод займёт примерно {0} минут",translationTakeApproximatelyMinute:"Перевод займёт примерно {0} минуты",unSupportedExtensionError:`Ошибка! ${GM_info.scriptHandler} не поддерживается этой версией расширения!\n\nПожалуйста, используйте cloudflare-версию расширения VOT.`,requestTranslationFailed:"Не удалось запросить перевод видео",audioNotReceived:"Не получена ссылка на аудио",grantPermissionToAutoPlay:"Предоставьте разрешение на автовоспроизведение",neededAdditionalExtension:"Для поддержки этого сайта необходимо дополнительное расширение",audioFormatNotSupported:"Формат аудио не поддерживается",VOTAutoTranslate:"Переводить при открытии",VOTDontTranslateYourLang:"Не переводить с родного языка",VOTVolume:"Громкость видео",VOTVolumeTranslation:"Громкость перевода",VOTAutoSetVolume:"Уменьшать громкость видео до ",VOTShowVideoSlider:"Слайдер громкости видео",VOTSyncVolume:"Связать громкость перевода и видео",VOTAudioProxy:"Проксировать полученное аудио",VOTDisableFromYourLang:"VOT: Вы отключили перевод видео на вашем языке",VOTLiveNotSupported:"VOT: Не поддерживается перевод трансляций в прямом эфире",VOTPremiere:"VOT: Дождитесь окончания премьеры перед переводом",VOTVideoIsTooLong:"VOT: Видео слишком длинное",VOTNoVideoIDFound:"VOT: Не найдено ID видео",VOTFailedInitDB:"VOT: Не удалось инициализовать базу данных",VOTDBNeedUpdate:"VOT: Базе данных нужно обновление, пожалуйста, перезагрузите страницу",VOTDisabledForDBUpdating:`VOT отключен из-за ошибки при обновление Базы Данных. Закройте все открытые вкладки с ${window.location.hostname} и попробуйте снова`,VOTFailedWriteToDB:"VOT: Не удалось записать данные в базу данных",VOTFailedReadFromDB:"VOT: Не удалось получить данные из базы данных",Russian:"Русский",English:"Английский",Chinese:"Китайский",French:"Французский",Italian:"Итальянский",Spanish:"Испанский",German:"Немецкий"},en:{recommended:"recommended",translateVideo:"Translate video",disableTranslate:"Turn off",translationSettings:"Translation settings",resetSettings:"Reset settings",videoBeingTranslated:"The video is being translated",videoLanguage:"Video language",translationLanguage:"Translation language",translationTake:"The translation will take",translationTakeMoreThanHour:"The translation will take more than an hour",translationTakeAboutMinute:"The translation will take about a minute",translationTakeFewMinutes:"The translation will take a few minutes",translationTakeApproximatelyMinutes:"The translation will take approximately {0} minutes",translationTakeApproximatelyMinute:"The translation will take approximately {0} minutes",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} is not supported by this version of the extension!\n\nPlease use the cloudflare version of the VOT extension.`,requestTranslationFailed:"Failed to request video translation",audioNotReceived:"Audio link not received",grantPermissionToAutoPlay:"Grant permission to autoplay",neededAdditionalExtension:"An additional extension is needed to support this site",audioFormatNotSupported:"The audio format is not supported",VOTAutoTranslate:"Translate on open",VOTDontTranslateYourLang:"Do not translate from my language",VOTVolume:"Video volume",VOTVolumeTranslation:"Translation Volume",VOTAutoSetVolume:"Reduce video volume to ",VOTShowVideoSlider:"Video volume slider",VOTSyncVolume:"Link translation and video volume",VOTAudioProxy:"Proxy received audio",VOTDisableFromYourLang:"VOT: You have disabled the translation of the video in your language",VOTLiveNotSupported:"VOT: Translation of live streams is not supported",VOTPremiere:"VOT: Wait for the premiere to end before translating",VOTVideoIsTooLong:"VOT: Video is too long",VOTNoVideoIDFound:"VOT: No video ID found",VOTFailedInitDB:"VOT: Failed to initialize database",VOTDBNeedUpdate:"VOT: The database needs an update, please reload the page",VOTDisabledForDBUpdating:`VOT is disabled due to an error when updating the Database. Close all open tabs with ${window.location.hostname} and try again`,VOTFailedWriteToDB:"VOT: Data could not be written to the database",VOTFailedReadFromDB:"VOT: Data could not be retrieved from the database",Russian:"Russian",English:"English",Chinese:"Chinese",French:"French",Italian:"Italian",Spanish:"Spanish",German:"German"},zh:{recommended:"推荐使用",translateVideo:"翻译视频",disableTranslate:"关掉",translationSettings:"翻译需要一个多小时",resetSettings:"重置设置",videoBeingTranslated:"视频正在翻译中",videoLanguage:"视频语言",translationLanguage:"翻译语言",translationTake:"翻译将采取",translationTakeMoreThanHour:"翻译将采取一个多小时",translationTakeAboutMinute:"翻译将采取一分钟",translationTakeFewMinutes:"翻译将采取几分钟",translationTakeApproximatelyMinutes:"翻译将采取大约需要{0}分钟",translationTakeApproximatelyMinute:"翻译将采取大约需要{0}分钟",unSupportedExtensionError:`错误! 此版本的扩展不支持 ${GM_info.scriptHandler}!\n\n请使用cloudflare版本的VOT扩展.`,requestTranslationFailed:"请求视频翻译失败",audioNotReceived:"未收到音频链接",grantPermissionToAutoPlay:"授予自动播放权限",neededAdditionalExtension:"需要一个额外的扩展来支持这个网站",audioFormatNotSupported:"不支持音频格式",VOTAutoTranslate:"打开时翻译",VOTDontTranslateYourLang:"不要从你的语言翻译过来",VOTVolume:"视频量",VOTVolumeTranslation:"翻译量",VOTAutoSetVolume:"将视频音量降低到",VOTShowVideoSlider:"视频音量滑块",VOTSyncVolume:"链接翻译和视频音量",VOTAudioProxy:"代理接收的音频",VOTDisableFromYourLang:"VOT:你已经禁用了你的语言的视频翻译",VOTLiveNotSupported:"VOT:不支持直播流的翻译",VOTPremiere:"VOT:等待首映结束后再翻译",VOTVideoIsTooLong:"VOT:视频太长",VOTNoVideoIDFound:"VOT: 没有找到视频ID",VOTFailedInitDB:"VOT: 初始化数据库失败",VOTDBNeedUpdate:"VOT: 数据库需要更新,请重新加载页面",VOTDisabledForDBUpdating:`VOT由于更新数据库时出错而被禁用。 关闭所有打开的选项卡${window.location.hostname} 再试一次`,VOTFailedWriteToDB:"VOT: 无法将数据写入数据库",VOTFailedReadFromDB:"VOT: 无法从数据库中检索数据",Russian:"俄语",English:"英语",Chinese:"中文",French:"法语",Italian:"意大利语",Spanish:"西班牙语",German:"德语"},de:{recommended:"es wird empfohlen",translateVideo:"Video übersetzen",disableTranslate:"Ausschalten",translationSettings:"Übersetzungseinstellungen",resetSettings:"Einstellungen zurücksetzen",videoBeingTranslated:"Das Video wird übersetzt",videoLanguage:"Sprache Video",translationLanguage:"Zielsprache",translationTake:"Die Übersetzung dauert",translationTakeMoreThanHour:"Die Übersetzung dauert mehr als eine Stunde",translationTakeAboutMinute:"Die Übersetzung dauert ungefähr eine Minute",translationTakeFewMinutes:"Die Übersetzung dauert einige Minuten",translationTakeApproximatelyMinutes:"Die Übersetzung dauert ungefähr {0} Minuten",translationTakeApproximatelyMinute:"Die Übersetzung dauert ungefähr {0} Minuten",unSupportedExtensionError:`Fehler! ${GM_info.scriptHandler} wird von dieser Version der Erweiterung nicht unterstützt!\n\nBitte verwenden Sie die Cloudflare-Version der VOT-Erweiterung.`,requestTranslationFailed:"Videoübersetzung konnte nicht angefordert werden",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Erteilen Sie die Berechtigung zur automatischen Wiedergabe",neededAdditionalExtension:"Eine zusätzliche Erweiterung ist erforderlich, um diese Website zu unterstützen",audioFormatNotSupported:"Das Audioformat wird nicht unterstützt",VOTAutoTranslate:"Beim Öffnen übersetzen",VOTDontTranslateYourLang:"Nicht aus Ihrer Sprache übersetzen",VOTVolume:"Video Lautstärke",VOTVolumeTranslation:"Übersetzungsvolumen",VOTAutoSetVolume:"Video-Lautstärke auf reduzieren ",VOTShowVideoSlider:"Video-Lautstärkeregler",VOTSyncVolume:"Übersetzungs- und Videolautstärke verknüpfen",VOTAudioProxy:"Empfangenes Audio proxyen",VOTDisableFromYourLang:"VOT: Sie haben die Übersetzung des Videos in Ihrer Sprache deaktiviert",VOTLiveNotSupported:"VOT: Übersetzung von Live-Streams wird nicht unterstützt",VOTPremiere:"VOT: Warten Sie, bis die Premiere beendet ist, bevor Sie übersetzen",VOTVideoIsTooLong:"VOT: Video ist zu lang",VOTNoVideoIDFound:"VOT: Keine Video-ID gefunden",VOTFailedInitDB:"VOT: Datenbank konnte nicht initialisiert werden",VOTDBNeedUpdate:"VOT: Die Datenbank muss aktualisiert werden, bitte laden Sie die Seite neu",VOTDisabledForDBUpdating:`VOT wurde aufgrund eines Fehlers beim Aktualisieren der Datenbank deaktiviert. Schließen Sie alle geöffneten Tabs mit ${window.location.hostname} und versuchen Sie es erneut`,VOTFailedWriteToDB:"VOT: Daten konnten nicht in die Datenbank geschrieben werden",VOTFailedReadFromDB:"VOT: Konnte keine Daten aus der Datenbank abrufen",Russian:"Russisch",English:"Englisch",Chinese:"Chinesisch",French:"Französisch",Italian:"Italienisch",Spanish:"Spanisch",German:"Deutsch"},es:{recommended:"es recomendable",translateVideo:"Traducir video",disableTranslate:"Apagar",translationSettings:"Ajustes de traducción",resetSettings:"Restablecer ajustes",videoBeingTranslated:"El video está siendo traducido",videoLanguage:"Idioma del video",translationLanguage:"Idioma de la traducción",translationTake:"La traducción tardará",translationTakeMoreThanHour:"La traducción tardará más de una hora",translationTakeAboutMinute:"La traducción tardará aproximadamente un minuto",translationTakeFewMinutes:"La traducción tardará unos minutos",translationTakeApproximatelyMinutes:"La traducción tardará aproximadamente {0} minutos",translationTakeApproximatelyMinute:"La traducción tardará aproximadamente {0} minutos",unSupportedExtensionError:`Error! ${GM_info.scriptHandler} no es compatible con esta versión de la extensión!\n\nUtilice la versión cloudflare de la extensión VOT.`,requestTranslationFailed:"Error al solicitar la traducción de vídeo",audioNotReceived:"Audiolink nicht empfangen",grantPermissionToAutoPlay:"Conceder permiso de reproducción automática",neededAdditionalExtension:"Se necesita una extensión adicional para admitir este sitio",audioFormatNotSupported:"El formato de audio no es compatible",VOTAutoTranslate:"Traducir al abrir",VOTDontTranslateYourLang:"No traduzca de su lengua",VOTVolume:"Volumen de vídeo",VOTVolumeTranslation:"Volumen de traducción",VOTAutoSetVolume:"Reducir el volumen del video al ",VOTShowVideoSlider:"Deslizador de volumen de video",VOTSyncVolume:"Vincular el volumen de traducción y video",VOTAudioProxy:"Proxificar el audio recibido",VOTDisableFromYourLang:"VOT: Ha desactivado la traducción del vídeo en su idioma",VOTLiveNotSupported:"VOT: No se admite la traducción de transmisiones en vivo",VOTPremiere:"VOT: Espere a que termine el estreno antes de traducir",VOTVideoIsTooLong:"VOT: El video es demasiado largo",VOTNoVideoIDFound:"VOT: No se encontró id de video",VOTFailedInitDB:"VOT: No se pudo inicializar la base de datos",VOTDBNeedUpdate:"VOT: la Base de datos necesita una actualización, por favor vuelva a cargar la página",VOTDisabledForDBUpdating:`VOT está deshabilitado debido a un error al actualizar la Base de Datos. Cierre todas las pestañas abiertas con ${window.location.hostname} y vuelve a intentarlo`,VOTFailedWriteToDB:"VOT: No se pudo escribir datos en la base de datos",VOTFailedReadFromDB:"VOT: No se pudo recuperar datos de la base de datos",Russian:"Ruso",English:"Inglés",Chinese:"Chino",French:"Francés",Italian:"Italiano",Spanish:"Español",German:"Alemán"},fr:{recommended:"recommande",translateVideo:"Traduire la vidéo",disableTranslate:"Désactiver",translationSettings:"Paramètres de traduction",resetSettings:"Réinitialiser les paramètres",videoBeingTranslated:"La vidéo est en cours de traduction",videoLanguage:"Langue vidéo",translationLanguage:"Langue cible",translationTake:"La traduction prendra",translationTakeMoreThanHour:"La traduction prendra plus d'une heure",translationTakeAboutMinute:"La traduction prendra environ une minute",translationTakeFewMinutes:"La traduction prendra quelques minutes",translationTakeApproximatelyMinutes:"La traduction prendra environ {0} minutes",translationTakeApproximatelyMinute:"La traduction prendra environ {0} minutes",unSupportedExtensionError:`Erreur! ${GM_info.scriptHandler} n'est pas supporté par cette version de l'extension!!\n\nVeuillez utiliser la version cloudflare de l'extension VOT.`,requestTranslationFailed:"Impossible de demander la traduction de la vidéo",audioNotReceived:"Lien audio non reçu",grantPermissionToAutoPlay:"Accorder l'autorisation de lecture automatique",neededAdditionalExtension:"Une extension supplémentaire est nécessaire pour prendre en charge ce site",audioFormatNotSupported:"Format audio non pris en charge",VOTAutoTranslate:"Traduire à l'ouverture",VOTDontTranslateYourLang:"Ne pas traduire à partir de votre langue",VOTVolume:"Volume de la vidéo",VOTVolumeTranslation:"Volume de traduction",VOTAutoSetVolume:"Réduire le volume de la vidéo à ",VOTShowVideoSlider:"Curseur de volume vidéo",VOTSyncVolume:"Lier le volume de la traduction et de la vidéo",VOTAudioProxy:"Proxy audio reçu",VOTDisableFromYourLang:"VOT: Vous avez désactivé la traduction de la vidéo dans votre langue",VOTLiveNotSupported:"VOT: La traduction des flux en direct n'est pas prise en charge",VOTPremiere:"VOT: Attendez la fin de la première avant de traduire",VOTVideoIsTooLong:"VOT: La vidéo est trop longue",VOTNoVideoIDFound:"VOT: ID vidéo introuvable",VOTFailedInitDB:"VOT: Impossible d'initialiser la base de données",VOTDBNeedUpdate:"VOT: la Base de données a besoin d'une mise à jour, veuillez recharger la page",VOTDisabledForDBUpdating:`VOT est désactivé en raison d'une erreur lors de la mise à jour de la Base de Données. Fermez tous les onglets ouverts avec ${window.location.hostname} et essayez à nouveau`,VOTFailedWriteToDB:"VOT: Impossible d'écrire les données dans la base de données",VOTFailedReadFromDB:"VOT: Impossible de récupérer les données de la base de données",Russian:"Russe",English:"Anglais",Chinese:"Chinois",French:"Français",Italian:"Italien",Spanish:"Espagnol",German:"Allemand"},it:{recommended:"è consigliabile",translateVideo:"Traduci il video",disableTranslate:"Spegnere",translationSettings:"Impostazioni di traduzione",resetSettings:"Ripristina impostazioni",videoBeingTranslated:"Il video è in fase di traduzione",videoLanguage:"Lingua Video",translationLanguage:"Lingua di traduzione",translationTake:"La traduzione richiederà",translationTakeMoreThanHour:"La traduzione richiederà più di un'ora",translationTakeAboutMinute:"La traduzione richiederà circa un minuto",translationTakeFewMinutes:"La traduzione richiederà alcuni minuti",translationTakeApproximatelyMinutes:"La traduzione richiederà circa {0} minuti",translationTakeApproximatelyMinute:"La traduzione richiederà circa {0} minuti",unSupportedExtensionError:`Errore! ${GM_info.scriptHandler} non è supportato da questa versione dell'estensione!\n\nUtilizzare la versione cloudflare dell'estensione VOT.`,requestTranslationFailed:"Richiesta di traduzione video non riuscita",audioNotReceived:"Collegamento audio non ricevuto",grantPermissionToAutoPlay:"Concedere l'Autorizzazione per la riproduzione automatica",neededAdditionalExtension:"Per supportare questo sito è necessaria un'estensione aggiuntiva",audioFormatNotSupported:"Il formato audio non è supportato",VOTAutoTranslate:"Traduci all'apertura",VOTDontTranslateYourLang:"Non traducete dalla vostra lingua",VOTVolume:"Volume video",VOTVolumeTranslation:"Volume di traduzione",VOTAutoSetVolume:"Riduci il volume del video al ",VOTShowVideoSlider:"Cursore del volume del video",VOTSyncVolume:"Collega il volume della traduzione e del video",VOTAudioProxy:"Proxy audio ricevuto",VOTDisableFromYourLang:"VOT: Avete disabilitato la traduzione del video nella vostra lingua",VOTLiveNotSupported:"VOT: La traduzione dei flussi dal vivo non è supportata",VOTPremiere:"VOT: Aspetta che la prima finisca prima di tradurre",VOTVideoIsTooLong:"VOT: Il video è troppo lungo",VOTNoVideoIDFound:"VOT: ID video non trovato",VOTFailedInitDB:"VOT: Impossibile inizializzare il database",VOTDBNeedUpdate:"VOT: Il database ha bisogno di aggiornamento, si prega di ricaricare la pagina",VOTDisabledForDBUpdating:`VOT è disabilitato a causa di un errore durante l'aggiornamento del database. CHIUDI tutte le schede aperte con ${window.location.hostname} e riprova`,VOTFailedWriteToDB:"VOT: Impossibile scrivere dati nel database",VOTFailedReadFromDB:"VOT: Impossibile recuperare i dati dal database",Russian:"Russo",English:"Inglese",Chinese:"Cinese",French:"Francese",Italian:"Italiano",Spanish:"Spagnolo",German:"Tedesco"}},V={log:(...e)=>{},translations:e=>{}};let f=(navigator.language||navigator.userLanguage).substr(0,2).toLowerCase();function w(e){document.querySelector(".translationBtn").style.color=e}function O(e="none"){document.querySelector(".translationBtn").dataset.state=e}function S(e="none"){let t;switch(e){case"error":t="#7A7A7D";break;case"success":t="#A36EFF";break;default:t="#FFFFFF"}document.querySelector(".translateIcon").style.fill=t}function x(e="none",t){switch(e){case"error":S(e),w("#7A7A7D"),O(e);break;case"success":S(e),w("#A36EFF"),O(e);break;default:S("none"),w("#FFFFFF"),O("none")}document.querySelector(".translationBtn").innerText=t}function k(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="checkbox",a.id=e,a.checked=Boolean(t),i.htmlFor=e,i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(a),o.appendChild(i),o}function L(e,t,n){const o=document.createElement("div"),a=document.createElement("input"),i=document.createElement("label");return a.type="range",a.id=e,a.classList.add("VOTMenuSlider"),a.min=0,a.max=100,a.value=t,i.htmlFor=e,i.classList.add("translationHeader"),i.innerHTML=n,o.classList.add("translationMenuContainer"),o.appendChild(i),o.appendChild(a),o}function F(e,t){const n=document.createElement("div"),o=document.createElement("select");o.id=e,o.classList.add("VOTMenuSelect");for(const e of t){const t=document.createElement("option");t.innerText=e.label,t.value=e.value,Object.prototype.hasOwnProperty.call(e,"selected")&&e.selected&&t.setAttribute("selected","selected"),Object.prototype.hasOwnProperty.call(e,"disabled")&&(t.disabled=e.disabled),o.appendChild(t)}return n.classList.add("translationMenuContainer"),n.appendChild(o),n}function D(e){return new Promise((t=>{const n=document.querySelector(e);if(n)return t(n);const o=new MutationObserver((()=>{const n=document.querySelector(e);n&&(t(n),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0,once:!0})}))}f in b||(f="en"),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,(function(t,n){return void 0!==e[n]?e[n]:t}))});const M=e=>new Promise((t=>setTimeout(t,e))),A=e=>{const t=new URL(window.location.href);switch(e){case"youtube":return t.pathname.match(/(?:watch|embed)\/([^/]+)/)?.[1]||t.searchParams.get("v");case"vk":return t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)?t.pathname.match(/^\/video-?[0-9]{8,9}_[0-9]{9}$/)[0].slice(1):t.searchParams.get("z")?t.searchParams.get("z").split("/")[0]:!(!t.searchParams.get("oid")||!t.searchParams.get("id"))&&`video-${Math.abs(t.searchParams.get("oid"))}_${t.searchParams.get("id")}`;case"9gag":case"gag":return t.pathname.match(/gag\/([^/]+)/)?.[1];case"twitch":if(/^m\.twitch\.tv$/.test(window.location.hostname)){const e=document.head.querySelector('link[rel="canonical"]');return e?.href.match(/videos\/([^/]+)/)?.[0]||t.pathname.slice(1)}if(/^player\.twitch\.tv$/.test(window.location.hostname))return`videos/${t.searchParams.get("video")}`;if(/^clips\.twitch\.tv$/.test(window.location.hostname)){const e=document.querySelector(".tw-link[data-test-selector='stream-info-card-component__stream-avatar-link']");return!!e&&`${e.href.replace("https://www.twitch.tv/","")}/clip/${t.searchParams.get("clip")}`}return t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)?t.pathname.match(/([^/]+)\/(?:clip)\/([^/]+)/)[0]:t.pathname.match(/(?:videos)\/([^/]+)/)?.[0];case"tiktok":return t.pathname.match(/video\/([^/]+)/)?.[1];case"vimeo":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0]||t.pathname.match(/[^/]+$/)?.[0];case"xvideos":return t.pathname.match(/[^/]+\/[^/]+$/)?.[0];case"pornhub":return t.searchParams.get("viewkey")||t.pathname.match(/embed\/([^/]+)/)?.[1];case"twitter":return t.pathname.match(/status\/([^/]+)/)?.[1];case"udemy":case"facebook":return t.pathname;case"rutube":return t.pathname.match(/(?:video|embed)\/([^/]+)/)?.[1];case"coub":return t.pathname.match(/view\/([^/]+)/)?.[1];case"bilibili.com":const e=t.searchParams.get("bvid");if(e)return e;{let e=t.pathname.match(/video\/([^/]+)/)?.[1];return e&&t.search&&null!==t.searchParams.get("p")&&(e+=`/?p=${t.searchParams.get("p")}`),e}case"mail.ru":if(t.pathname.startsWith("/v/")||t.pathname.startsWith("/mail/"))return t.pathname;if(t.pathname.match(/video\/embed\/([^/]+)/)){const e=document.querySelector(".b-video-controls__mymail-link");return!!e&&e?.href.split("my.mail.ru")?.[1]}default:return!1}};var q=n("./src/config/config.js");const E=["invidious.snopyta.org","yewtu.be","invidious.kavin.rocks","vid.puffyan.us","invidious.namazso.eu","inv.riverside.rocks","yt.artemislena.eu","invidious.flokinet.to","invidious.esmailelbob.xyz","y.com.sb","invidious.nerdvpn.de","inv.vern.cc","invidious.slipfox.xyz","invidio.xamh.de","invidious.dhusch.de"],I=["piped.video","piped.tokhmi.xyz","piped.moomoo.me","piped.syncpundit.io","piped.mha.fi","watch.whatever.social","piped.garudalinux.org","efy.piped.pages.dev","watch.leptons.xyz","piped.lunar.icu","yt.dc09.ru","piped.mint.lgbt","il.ax","piped.privacy.com.de","piped.esmailelbob.xyz","piped.projectsegfau.lt","piped.in.projectsegfau.lt","piped.us.projectsegfau.lt","piped.privacydev.net","piped.palveluntarjoaja.eu","piped.smnz.de","piped.adminforge.de","piped.qdi.fi","piped.hostux.net","piped.chauvet.pro","piped.jotoma.de","piped.pfcd.me","piped.frontendfriendly.xyz"],P=2,B={key:"settings",autoTranslate:0,defaultVolume:100,showVideoSlider:0,syncVolume:0,autoSetVolumeYandexStyle:1,dontTranslateYourLang:1},z={audioProxy:0};function C(e){return indexedDB.open(e,P)}async function N(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{console.error(`${b[f].VOTFailedInitDB}: ${n.error.message}`),t(!1)},n.onupgradeneeded=o=>{const a=n.result;if(a.onerror=()=>{const e=b[f].VOTFailedInitDB;alert(e),console.error(e,n.error),t(!1)},o.oldVersion<1){const n=a.createObjectStore("settings",{keyPath:"key"});for(const e of Object.keys(B).filter((e=>"key"!==e)))n.createIndex(e,e,{unique:!1});console.log("VOT: Database Created"),n.transaction.oncomplete=n=>{const o=a.transaction("settings","readwrite").objectStore("settings").add(B);o.onsuccess=()=>{console.log("VOT: Standard settings added to the Database: ",o.result),e(!0)},o.onerror=()=>{console.log("VOT: Error when adding standard settings to the Database: ",o.error),t(!1)}}}o.oldVersion<2&&function(n,o,a,i={}){const r=n.objectStore("settings");for(const e of Object.keys(a))r.createIndex(e,e,{unique:!1});console.log("VOT: The database has been updated"),r.transaction.oncomplete=n=>{const r=o.transaction("settings","readwrite").objectStore("settings"),s=r.get("settings");s.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),t(!1)},s.onsuccess=()=>{const n=s.result||Object.assign(B,i);for(const e in a)n[e]=a[e];const o=r.put(n);o.onerror=e=>{console.error("VOT: Failed to update the Database to new version",e.error),t(!1)},o.onsuccess=()=>{console.log("VOT: Standard settings of the new version have been added to the Database."),e(!0)}}}}(n.transaction,a,z)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=b[f].VOTDBNeedUpdate;alert(e),console.log(e),window.location.reload(),t(!1)},e(!0)},n.onblocked=()=>{const e=n.result,o=b[f].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}async function R({autoTranslate:e,defaultVolume:t,showVideoSlider:n,syncVolume:o,autoSetVolumeYandexStyle:a,dontTranslateYourLang:i,audioProxy:r}){return new Promise(((s,l)=>{if("number"==typeof e||"number"==typeof t||"number"==typeof n||"number"==typeof o||"number"==typeof a||"number"==typeof i||"number"==typeof r){const d=C("VOT");d.onerror=()=>{const e=b[f].VOTFailedWriteToDB;alert(e),console.error(e,d.error.message),l(!1)},d.onupgradeneeded=async()=>{d.result.close(),await N(),s(!0)},d.onsuccess=()=>{const u=d.result;u.onversionchange=()=>{u.close(),console.log("VOT: The database needs an update, please reload the page if it didn't happen automatically"),window.location.reload(),l(!1)};const c=u.transaction("settings","readwrite").objectStore("settings"),p=c.get("settings");p.onerror=e=>{console.error("VOT: Data could not be retrieved from the Database: ",e.error),l(!1)},p.onsuccess=()=>{const d=p.result;"number"==typeof e&&(d.autoTranslate=e),"number"==typeof t&&(d.defaultVolume=t),"number"==typeof n&&(d.showVideoSlider=n),"number"==typeof o&&(d.syncVolume=o),"number"==typeof a&&(d.autoSetVolumeYandexStyle=a),"number"==typeof i&&(d.dontTranslateYourLang=i),"number"==typeof r&&(d.audioProxy=r);const u=c.put(d);u.onerror=e=>{console.error("VOT: Не удалось обновить данные в Базе Данных: ",e.error),l(!1)},u.onsuccess=()=>{s(!0)}}},d.onblocked=()=>{const e=d.result,t=b[f].VOTDisabledForDBUpdating;console.error(t,e),alert(t),l(!1)}}}))}function j(){indexedDB.deleteDatabase("VOT")}function $(e,t,n,o){let a;return t>o?(a=n+(t-o),a=a>100?100:Math.max(a,0),e.volume=a/100):t100?100:Math.max(a,0),e.volume=a/100),a}const _={youtubeRegex:/^(www.|m.)?youtube(-nocookie)?.com$/},H=".html5-video-container",U=".video-ref",Y="main > div > section > div > div > div",G=".shaka-video-container",W=".videoplayer_media",Z='div[data-testid="videoComponent"] > div:nth-child(1) > div',K=".player",J=".video-post",X=".bpx-player-video-wrap",Q="#b-video-wrapper",ee=[...E,...I];let te=f,ne="";(async function(){V.log("Loading extension..."),V.log(`Selected menu language: ${f}`);const e=(await Promise.resolve().then(n.bind(n,"./src/rvt.js"))).default;if(V.log("Inited requestVideoTranslation..."),GM_info?.scriptHandler&&["Violentmonkey","FireMonkey","Greasemonkey","AdGuard"].includes(GM_info.scriptHandler)){const e=b[f].unSupportedExtensionError;return console.error(e),alert(e)}let t;V.log("Extension compatibility passed...");const o=new Audio;let a=.9,i=!1;function r(e){i||(document.querySelector(".translationBlock").style.opacity=e)}function s(){clearTimeout(t),r(1),t=setTimeout((()=>{r(0)}),2e3)}function l(e,t,n){clearTimeout(t),r(n),e.stopPropagation()}async function d(n,d,u){let c,p,m,g,w,O,S,D,M,E,I,P;V.log("[translateProccessor] execute on element: ",n);let B,z=!0,_="";V.log("videoContainer",n),c="vimeo"===d?n.querySelector(".vp-video-wrapper > .vp-video > .vp-telecine > video"):n.querySelector("video"),V.log("video",c);const H="pornhub"===d&&window.location.pathname.includes("view_video.php")?document.querySelector(".original.mainPlayerDiv"):"pornhub"===d&&window.location.pathname.includes("embed/")?document.querySelector("body"):window.location.hostname.includes("m.youtube.com")?document.querySelector("#player-control-container"):n;!function(e){if(!e||e.querySelector(".translationBlock"))return;const t=document.createElement("div");t.classList.add("translationBlock"),t.innerHTML=`\n \n \n \n \n \n \n ${b[f].translateVideo}\n \n \n \n \n \n \n `,e.appendChild(t),V.log("VOT: Added translation button to ",e)}(H),function(e){if(e.querySelector(".translationMenuContent"))return;const t=function(){const e=document.createElement("div");return e.classList.add("translationMenuContent"),e.innerHTML=`\n

${b[f].translationSettings}

\n
\n
\n \n \n \n \n \n \n
\n `,e.onclick=e=>e.stopPropagation(),e}();e.appendChild(t),document.querySelector(".translationMenu")?.addEventListener("click",(e=>{e.stopPropagation();const t=document.querySelector(".translationMenuContent");t.style.display=i?"none":"block",t.style.opacity=a,i=!i})),document.querySelector(".translationDropDB").addEventListener("click",(e=>{e.stopPropagation(),j(),location.reload()})),V.log("VOT: Added translation menu to ",e)}(H);try{B=await N()}catch(e){console.error("[VOT] Failed to initialize database settings. All changes made will not be saved",e)}const U=document.querySelector(".translationMenuOptions");if(U&&!U.querySelector("#VOTTranslateFromLang")){const e=[{label:b[f].videoLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[f][t],value:e,selected:_.detectedLanguage===e})))],t=[{label:b[f].translationLanguage,value:"default",disabled:!0},...Object.entries(v).map((([e,t])=>({label:b[f][t],value:e,selected:_.responseLanguage===e})))],n=F("VOTTranslateFromLang",e),o=F("VOTTranslateToLang",t).firstElementChild;n.id="VOTSelectLanguages",n.innerHTML+='\n \n \n \n ',n.appendChild(o),U.appendChild(n),U.querySelector("#VOTTranslateFromLang").addEventListener("change",(async e=>{V.log("[onchange] select from language",e.target.value),_=await Z(),await Y(e.target.value,_.responseLanguage)})),U.querySelector("#VOTTranslateToLang").addEventListener("change",(async e=>{V.log("[onchange] select to language",e.target.value),_=await Z(),await Y(_.detectedLanguage,e.target.value)}))}if(B){const e=await async function(){return new Promise(((e,t)=>{const n=C("VOT");n.onerror=()=>{const e=b[f].VOTFailedReadFromDB;alert(e),console.error(e,n.error.message),t(!1)},n.onupgradeneeded=async()=>{n.result.close(),await N(),e(!0)},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close();const e=b[f].VOTDBNeedUpdate;alert(e),console.error(e),t(!1)};const a=o.transaction("settings").objectStore("settings").get("settings");a.onerror=e=>{console.error(b[f].VOTFailedReadFromDB,e.error),console.error(e),t(!1)},a.onsuccess=()=>{void 0===a.result&&(o.close(),j(),t(!1));const n=a.result;e(n)}},n.onblocked=()=>{const e=n.result,o=b[f].VOTDisabledForDBUpdating;console.error(o,e),alert(o),t(!1)}}))}();if(e){if(O=e.autoTranslate,S=e.defaultVolume,D=e.showVideoSlider,M=e.autoSetVolumeYandexStyle,E=e.dontTranslateYourLang,P=e.audioProxy,I=e.syncVolume,V.log("[db] data from db: ",e),void 0!==O&&U&&!U.querySelector("#VOTAutoTranslate")){const e=k("VOTAutoTranslate",O,b[f].VOTAutoTranslate+("vk"===d||window.location.hostname.includes("m.twitch.tv")?` (${b[f].recommended})`:""));e.querySelector("#VOTAutoTranslate").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoTranslate:t}),O=t,V.log("autoTranslate value changed. New value: ",O)},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&void 0!==E&&U&&!U.querySelector("#VOTDontTranslateYourLang")){const e=k("VOTDontTranslateYourLang",E,b[f].VOTDontTranslateYourLang);e.querySelector("#VOTDontTranslateYourLang").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({dontTranslateYourLang:t}),E=t,V.log("dontTranslateYourLang value changed. New value: ",E)},U.appendChild(e)}if(void 0!==M&&U&&!U.querySelector("#VOTAutoSetVolume")){const e=k("VOTAutoSetVolume",M,b[f].VOTAutoSetVolume+(100*q.IM+"%"));e.querySelector("#VOTAutoSetVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({autoSetVolumeYandexStyle:t}),M=t,V.log("autoSetVolumeYandexStyle value changed. New value: ",M)},U.appendChild(e)}if(void 0!==D&&U&&!U.querySelector("#VOTShowVideoSlider")){const e=k("VOTShowVideoSlider",D,b[f].VOTShowVideoSlider);e.querySelector("#VOTShowVideoSlider").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({showVideoSlider:t}),D=t,V.log("showVideoSlider value changed. New value: ",D),1===D&&"success"===document.querySelector(".translationBtn").dataset.state?J():document.querySelector("#VOTVideoSlider")?.parentElement.remove()},U.appendChild(e)}if(window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&void 0!==I&&U&&!U.querySelector("#VOTSyncVolume")){const e=k("VOTSyncVolume",I,b[f].VOTSyncVolume);e.querySelector("#VOTSyncVolume").onclick=async e=>{e.stopPropagation();const t=Number(e.target.checked);await R({syncVolume:t}),I=t,V.log("syncVolume value changed. New value: ",I)},U.appendChild(e)}}}async function Y(e,t){document.querySelector("#VOTSelectLanguages")&&(document.querySelector("#VOTTranslateFromLang").value=e,document.querySelector("#VOTTranslateToLang").value=t,console.log(`Set translation from ${e} to ${t}`),_.detectedLanguage=e,_.responseLanguage=t)}async function G(){o.pause(),c.removeEventListener(".translate",G,!1),await(async()=>{o.src="",o.removeAttribute("src")})(),document.querySelector("#VOTVideoSlider")?.parentElement.remove(),document.querySelector("#VOTTranslationSlider")?.parentElement.remove();const e=document.querySelector(".translationDownload");e.href="",e.style.display="none",x("none",b[f].translateVideo),m&&(c.volume=m)}async function W(){const e=document.querySelector(".ytp-volume-panel").getAttribute("aria-valuenow"),t=document.querySelector("#VOTVideoSlider");if(!t)return;t.value=e;const n=document.querySelector("#VOTVideoVolume");n&&(n.innerText=`${e}%`),1===I&&(g=Number(e))}async function Z(){const e={};return e.duration=c?.duration||0,e.videoId=A(d),e.detectedLanguage="en",e.responseLanguage=te,window.location.hostname.includes("youtube.com")?(ne=await async function(){const e=document.querySelector("#movie_player"),t=e.getVideoData(),n=e.getPlayerResponse(),{isLive:o,isPremiere:a,title:i,author:r}=t,{shortDescription:s}=n?.videoDetails??{},l={isLive:o,isPremiere:a,title:i,description:s,author:r,detectedLanguage:await h(e,n,i,s,r)};return console.log("VOT Detected language: ",l.detectedLanguage),l}(),""!==ne.author&&(e.detectedLanguage=ne.detectedLanguage,e.responseLanguage=f)):window.location.hostname.includes("rutube")||window.location.hostname.includes("my.mail.ru")?(e.detectedLanguage="ru",e.responseLanguage="en"):window.location.hostname.includes("bilibili.com")&&(e.detectedLanguage="zh"),e}x("none",b[f].translateVideo),window.location.hostname.includes("youtube.com")&&!window.location.hostname.includes("m.youtube.com")&&new MutationObserver((async function(e){e.forEach((async function(e){"attributes"===e.type&&"aria-valuenow"===e.attributeName&&document.querySelector("#VOTVideoSlider")&&W()}))})).observe(document.querySelector(".ytp-volume-panel"),{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});const K=async(e=!1)=>{if(V.log("lipsync video",c),c)if(o.currentTime=c.currentTime,o.playbackRate=c.playbackRate,e)if("play"!==e)"pause"===e&&(V.log("lipsync mode is pause"),o.pause()),"stop"===e&&(V.log("lipsync mode is stop"),o.pause()),"waiting"===e&&(V.log("lipsync mode is waiting"),o.pause()),"playing"===e&&(V.log("lipsync mode is playing"),o.play());else{V.log("lipsync mode is play");const e=o.play();void 0!==e&&e.catch((e=>{if(console.error(e),"NotAllowedError"===e.name){const e=b[f].grantPermissionToAutoPlay;throw x("error",e),`VOT: ${e}`}if("NotSupportedError"===e.name){const e=ee.includes(window.location.hostname)?b[f].neededAdditionalExtension:b[f].audioFormatNotSupported;throw x("error",e),`VOT: ${e}`}}))}else V.log("lipsync mode is not set")};async function J(){if(1!==D||document.querySelector("#VOTVideoSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e=window.location.hostname.includes("youtube.com")&&!M?document.querySelector(".ytp-volume-panel")?.getAttribute("aria-valuenow"):Math.round(100*c.volume);g=e;const t=L("VOTVideoSlider",e,`${b[f].VOTVolume}: ${e}%`);t.querySelector("#VOTVideoSlider").oninput=async e=>{const{value:n}=e.target;if(c.volume=n/100,t.querySelector("#VOTOriginalVolume").innerText=`${n}%`,1!==I)return;const a=document.querySelector("#VOTTranslationSlider");if(!a)return;const i=Number(a.value),r=$(o,n,i,g);a.value=r;const s=document.querySelector("#VOTTranslationVolume");s&&(s.innerText=`${r}%`),w=r,g=n},document.querySelector(".translationMenuOptions").appendChild(t)}const X=async e=>{_.detectedLanguage||(_=await Z(),await Y(_.detectedLanguage,_.responseLanguage)),V.log("Run videoValidator"),await async function(){if(window.location.hostname.includes("youtube.com")){if(V.log("VideoValidator videoData: ",_),1===E&&_.detectedLanguage===f&&_.responseLanguage===f)throw b[f].VOTDisableFromYourLang;if(ne.isLive)throw b[f].VOTLiveNotSupported;if(ne.isPremiere)throw b[f].VOTPremiere;if(_.duration>14400)throw b[f].VOTVideoIsTooLong}return!0}(),V.log("Run translateFunc"),await ae(e,_.detectedLanguage,_.responseLanguage)};async function Q(e){V.log(`video ${e.type}`),await K(e.type)}async function oe(){await G(),await W()}async function ae(t,a,i){console.log("VOT Video Data: ",_),function(t,n,o,a,i){V.log(`Translate video (url: ${t}, unknown1: ${n}, requestLang: ${o}, responseLang: ${a})`),e(t,n,o,a,((e,t)=>{if(V.log("[exec callback] Requesting video translation"),!e)return void i(!1,b[f].requestTranslationFailed);const n=T.G.decodeResponse(t);switch(console.log("VOT Response: ",n),n.status){case 0:i(!1,n.message);break;case 1:i(!!n.url,n.url||b[f].audioNotReceived);break;case 2:i(!1,n.remainingTime?function(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t>=60?b[f].translationTakeMoreThanHour:t>=10&&t%10?b[f].translationTakeApproximatelyMinutes.format(t):1==t||0==t&&n>0?b[f].translationTakeAboutMinute:b[f].translationTakeApproximatelyMinute.format(t)}(n.remainingTime):b[f].translationTakeFewMinutes);break;case 3:i(!1,b[f].videoBeingTranslated)}}))}(`${y[d]}${t}`,0x4075500000000000,a,i,(async(e,r)=>{if(V.log("[exec callback] translateVideo"),A(d)!==t)return;if(!e)throw x("error",r),r.includes(b[f].translationTake)&&(clearTimeout(p),p=setTimeout((()=>ae(t,a,i)),6e4)),r;switch(o.src=r,m=c?.volume,"number"==typeof S&&(o.volume=S/100),"number"==typeof M&&M&&(c.volume=q.IM),d){case"twitter":document.querySelector('div[data-testid="app-bar-back"][role="button"]').addEventListener("click",oe);break;case"invidious":case"piped":break;default:null!==u&&document.body.addEventListener(u,oe)}const s=["twitch","vimeo","facebook","rutube","twitter","bilibili.com","mail.ru"];for(let e=0;e{e.forEach((async e=>{"attributes"===e.type&&"src"===e.attributeName&&e.target===c&&""!==e.target.src&&(oe(),z=!0)}))})).observe(n,{attributes:!0,childList:!1,subtree:!0,attributeOldValue:!0});break}c&&!c.paused&&K("play");const l=document.querySelectorAll("video"),h=["playing","ratechange","play","abort","waiting","pause"];l.forEach((e=>h.forEach((t=>e.addEventListener(t,Q))))),x("success",b[f].disableTranslate),await J(),await async function(){if(document.querySelector("#VOTTranslationSlider")||"success"!==document.querySelector(".translationBtn").dataset.state)return;const e="number"==typeof S?S:100;g=e;const t=L("VOTTranslationSlider",e,`${b[f].VOTVolumeTranslation}: ${e}%`);t.querySelector("#VOTTranslationSlider").oninput=async({target:{value:e}})=>{o.volume=e/100,document.querySelector("#VOTTranslationVolume").innerText=`${e}%`,await R({defaultVolume:Number(e)}),S=Number(e),1===I&&function(e){const t=document.querySelector("#VOTVideoSlider");if(!t)return;const n=Number(t.value),o=$(c,e,n,w);t.value=o;const a=document.querySelector("#VOTOriginalVolume");a&&(a.innerText=`${o}%`),g=o,w=e}(e)},document.querySelector(".translationMenuOptions").appendChild(t)}();const T=document.querySelector("#VOTVideoSlider");T&&(T.value=100*q.IM);const v=document.querySelector("#VOTOriginalVolume");v&&(v.innerText=100*q.IM+"%");const y=document.querySelector(".translationDownload");y.href=r,y.style.display="initial"}))}document.addEventListener("click",(async e=>{const t=document.querySelector(".translationBlock"),o=document.querySelector(".translationMenuContent"),a=!(!t&&e.target!==t)&&t.contains(e.target),s=!(!o&&e.target!==o)&&o.contains(e.target),l=!(!n&&e.target!==n)&&n.contains(e.target);V.log(`[document click] ${a} ${s} ${l}`),a||s||(l||r(0),o.style.display="none",i=!1)}));const ie=(e,t,n)=>{t.forEach((t=>e.addEventListener(t,(async e=>{await n(e)}))))};"pornhub"===d?window.location.pathname.includes("view_video.php")?ie(document.querySelector(".original.mainPlayerDiv > video-element > div"),["mousemove","mouseout"],s):window.location.pathname.includes("embed/")&&ie(document.querySelector("#player"),["mousemove","mouseout"],s):ie("twitter"===d?document.querySelector('div[data-testid="videoPlayer"'):n,["mousemove","mouseout"],s),document.querySelector(".translationBlock").addEventListener("mousemove",(e=>l(e,t,a))),document.querySelector(".translationMenuContent").addEventListener("mousemove",(e=>l(e,t,a))),document.addEventListener("touchstart",(e=>l(e,t,a))),document.addEventListener("touchmove",(e=>l(e,t,a))),document.addEventListener("touchend",(e=>l(e,t,a))),document.querySelectorAll("video").forEach((e=>{e.addEventListener("abort",(async()=>{V.log("lipsync mode is abort"),await oe(),_=""}))})),document.querySelector(".translationBtn").addEventListener("click",(async e=>{if(V.log("[click translationBtn] before all functions & methods"),e.stopPropagation(),e.stopImmediatePropagation(),o.src)return V.log("[click translationBtn] audio.src is not empty"),void await G();try{V.log("[click translationBtn] trying execute translation");const e=A(d);if(!e)throw b[f].VOTNoVideoIDFound;await X(e)}catch(e){x("error",String(e).substring(4,e.length)),console.error(e)}})),c.addEventListener("progress",(async e=>{if(e.stopPropagation(),!z||1!==O)return;const t=A(d);if(!t)throw b[f].VOTNoVideoIDFound;try{await X(t),z=!1}catch(e){x("error",String(e).substring(4,e.length)),z=!1}}))}await async function(){if(V.log("Runned initWebsite function"),_.youtubeRegex.test(window.location.hostname)){if(window.location.pathname.includes("embed")){const e=document.querySelector(".html5-video-container");return void await d(e,"youtube",null)}V.log("[initWebsite] Found a match with youtube hostname");const e=()=>{const e=document.querySelector(H);if(e)V.log("[exec] translateProccessor youtube on page enter"),d(e,"youtube","yt-translate-stop");else{if(!ytplayer||!ytplayer.config)return void V.log("[exec] ytplayer is null");ytplayer.config.args.jsapicallback=()=>{V.log("[exec] translateProccessor youtube on page enter (ytplayer.config.args.jsapicallback)"),d(e,"youtube","yt-translate-stop")}}};document.addEventListener("spfdone",e),document.addEventListener("yt-navigate-finish",e);const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};if(document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t),window.location.hostname.includes("m.youtube.com")){let e=await D("#player");e&&(await M(1e3),await d(e,"youtube","yt-translate-stop"),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&(e=await D("#player"),await M(1e3),await d(e,"youtube","yt-translate-stop"))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0}));const t=()=>{document.body.dispatchEvent(new Event("yt-translate-stop"))};document.addEventListener("spfdone",t),document.addEventListener("yt-navigate-finish",t),document.addEventListener("spfrequest",t),document.addEventListener("yt-navigate-start",t)}}else if(window.location.hostname.includes("twitch.tv")){if(V.log("[initWebsite] Found a match with twitch.tv"),window.location.hostname.includes("m.twitch.tv")&&(window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/"))){if(V.log("[initWebsite] Matched Twitch Mobile"),await D(Y)){await M(200);const e=document.querySelector(Y);await d(e,"twitch",null),new MutationObserver((async t=>{for(const n of t)"attributes"===n.type&&"src"===n.attributeName&&n.target===e?.querySelector("video")&&(await M(1e3),await d(e,"twitch",null))})).observe(e,{attributes:!0,childList:!0,subtree:!0,attributeOldValue:!0})}}else if(window.location.hostname.includes("player.twitch.tv")||window.location.hostname.includes("clips.twitch.tv")||window.location.pathname.includes("/videos/")||window.location.pathname.includes("/clip/")){V.log("[initWebsite] Matched Twitch Desktop");const e=await D(U);e&&(await M(200),await d(e,"twitch",null))}V.log("[initWebsite] Exit function in the twitch section")}else{if(window.location.hostname.includes("xvideos.com"))return V.log("[entered] xvideos"),await M(1e3),void await d(document.querySelector(".video-bg-pic"),"xvideos",null);if(window.location.hostname.includes("pornhub.com"))return V.log("[entered] pornhub"),await M(1e3),void await d(document.querySelector(".mgp_videoWrapper"),"pornhub",null);if(E.includes(window.location.hostname))V.log("[entered] invidious"),await d(document.querySelector("#player"),"youtube",null);else if(I.includes(window.location.hostname)){V.log("[entered] piped");const e=await D(G);if(e){let t,n=A("youtube");await d(e,"youtube","piped"),setInterval((async()=>{t=A("youtube"),n!==t&&(t&&await d(document.querySelector(G),"youtube","piped"),n=t)}),3e3)}}else if(/^(www.|m.)?vk.(com|ru)$/.test(window.location.hostname)){if(V.log("[entered] vk.com"),await D(W)){let e;await d(document.querySelector(W),"vk",null);let t=A("vk");setInterval((async()=>{if(e=A("vk"),t!==e){if(e){const e=await D(W);e&&await d(e,"vk",null)}t=e}}),3e3)}}else if(window.location.hostname.includes("vimeo.com"))V.log("[entered] vimeo.com"),await D(K)&&(await M(1e3),await d(document.querySelector(K),"vimeo",null));else if(window.location.hostname.includes("9gag.com"))await M(1e3),await d(document.querySelector(J),"9gag",null);else if(window.location.hostname.includes("coub.com"))await M(1e3),await d(document.querySelector(".viewer__player"),"coub",null);else if(window.location.hostname.includes("rutube.ru")){const e=window.location.pathname.includes("/play/embed")?"#app > div > div":".video-player > div > div > div:nth-child(2)",t=await D(e);t&&await d(t,"rutube",null)}else if(window.location.hostname.includes("bilibili.com")){if(window.location.pathname.includes("/video/")){const e=await D(X);e&&await d(e,"bilibili.com",null)}else if(window.location.pathname.includes("/blackboard/webplayer/embed-old.html")){const e=await D("video");e&&await d(e.parentElement,"bilibili.com",null)}}else if(window.location.hostname.includes("twitter.com")){const e=await D(Z);if(e){let t,n=A("twitter");await d(e,"twitter",null),setInterval((async()=>{t=A("twitter"),n!==t&&(t&&await d(document.querySelector(Z),"twitter",null),n=t)}),3e3)}}else if(window.location.hostname.includes("my.mail.ru")){const e=await D(Q);if(e){let t,n=A("mail.ru");await d(e,"mail.ru",null),setInterval((async()=>{t=A("mail.ru"),n!==t&&(t&&await d(document.querySelector(Q),"mail.ru",null),n=t)}),3e3)}}}}()})().catch((e=>{console.error(e)}))})()})(); \ No newline at end of file diff --git a/dist/vot.user.js b/dist/vot.user.js index 293a5ee7..20da39b9 100644 --- a/dist/vot.user.js +++ b/dist/vot.user.js @@ -1106,9 +1106,9 @@ async function getLanguage(player, response, title, description, author) { const text = [title, description, author].join(" "); // Remove anything that is not a letter or a space in any language const cleanText = text + .replace(/\s+/g, " ").trim() .replace(/https?:\/\/\S+/g, "") .replace(/[^\p{L}\s]/gu, "") - .trim() .slice(0, 250); return await detect(cleanText); } diff --git a/src/utils/getYTVideoData.js b/src/utils/getYTVideoData.js index e41d4009..19bb0669 100644 --- a/src/utils/getYTVideoData.js +++ b/src/utils/getYTVideoData.js @@ -31,9 +31,9 @@ async function getLanguage(player, response, title, description, author) { const text = [title, description, author].join(" "); // Remove anything that is not a letter or a space in any language const cleanText = text + .replace(/\s+/g, " ").trim() .replace(/https?:\/\/\S+/g, "") .replace(/[^\p{L}\s]/gu, "") - .trim() .slice(0, 250); return await detect(cleanText); }